Commit 0a168933 authored by Jerome Glisse's avatar Jerome Glisse Committed by Alex Deucher

drm/radeon: use radeon device for request firmware

Avoid creating temporary platform device that will lead to issue
when several radeon gpu are in same computer. Instead directly use
the radeon device for requesting firmware.
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarJerome Glisse <jglisse@redhat.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 1b6e5fd5
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
* Authors: Alex Deucher * Authors: Alex Deucher
*/ */
#include <linux/firmware.h> #include <linux/firmware.h>
#include <linux/platform_device.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/module.h>
#include "drmP.h" #include "drmP.h"
...@@ -742,7 +741,6 @@ static int ci_mc_load_microcode(struct radeon_device *rdev) ...@@ -742,7 +741,6 @@ static int ci_mc_load_microcode(struct radeon_device *rdev)
*/ */
static int cik_init_microcode(struct radeon_device *rdev) static int cik_init_microcode(struct radeon_device *rdev)
{ {
struct platform_device *pdev;
const char *chip_name; const char *chip_name;
size_t pfp_req_size, me_req_size, ce_req_size, size_t pfp_req_size, me_req_size, ce_req_size,
mec_req_size, rlc_req_size, mc_req_size, mec_req_size, rlc_req_size, mc_req_size,
...@@ -752,13 +750,6 @@ static int cik_init_microcode(struct radeon_device *rdev) ...@@ -752,13 +750,6 @@ static int cik_init_microcode(struct radeon_device *rdev)
DRM_DEBUG("\n"); DRM_DEBUG("\n");
pdev = platform_device_register_simple("radeon_cp", 0, NULL, 0);
err = IS_ERR(pdev);
if (err) {
printk(KERN_ERR "radeon_cp: Failed to register firmware\n");
return -EINVAL;
}
switch (rdev->family) { switch (rdev->family) {
case CHIP_BONAIRE: case CHIP_BONAIRE:
chip_name = "BONAIRE"; chip_name = "BONAIRE";
...@@ -794,7 +785,7 @@ static int cik_init_microcode(struct radeon_device *rdev) ...@@ -794,7 +785,7 @@ static int cik_init_microcode(struct radeon_device *rdev)
DRM_INFO("Loading %s Microcode\n", chip_name); DRM_INFO("Loading %s Microcode\n", chip_name);
snprintf(fw_name, sizeof(fw_name), "radeon/%s_pfp.bin", chip_name); snprintf(fw_name, sizeof(fw_name), "radeon/%s_pfp.bin", chip_name);
err = request_firmware(&rdev->pfp_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev);
if (err) if (err)
goto out; goto out;
if (rdev->pfp_fw->size != pfp_req_size) { if (rdev->pfp_fw->size != pfp_req_size) {
...@@ -806,7 +797,7 @@ static int cik_init_microcode(struct radeon_device *rdev) ...@@ -806,7 +797,7 @@ static int cik_init_microcode(struct radeon_device *rdev)
} }
snprintf(fw_name, sizeof(fw_name), "radeon/%s_me.bin", chip_name); snprintf(fw_name, sizeof(fw_name), "radeon/%s_me.bin", chip_name);
err = request_firmware(&rdev->me_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
if (err) if (err)
goto out; goto out;
if (rdev->me_fw->size != me_req_size) { if (rdev->me_fw->size != me_req_size) {
...@@ -817,7 +808,7 @@ static int cik_init_microcode(struct radeon_device *rdev) ...@@ -817,7 +808,7 @@ static int cik_init_microcode(struct radeon_device *rdev)
} }
snprintf(fw_name, sizeof(fw_name), "radeon/%s_ce.bin", chip_name); snprintf(fw_name, sizeof(fw_name), "radeon/%s_ce.bin", chip_name);
err = request_firmware(&rdev->ce_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->ce_fw, fw_name, rdev->dev);
if (err) if (err)
goto out; goto out;
if (rdev->ce_fw->size != ce_req_size) { if (rdev->ce_fw->size != ce_req_size) {
...@@ -828,7 +819,7 @@ static int cik_init_microcode(struct radeon_device *rdev) ...@@ -828,7 +819,7 @@ static int cik_init_microcode(struct radeon_device *rdev)
} }
snprintf(fw_name, sizeof(fw_name), "radeon/%s_mec.bin", chip_name); snprintf(fw_name, sizeof(fw_name), "radeon/%s_mec.bin", chip_name);
err = request_firmware(&rdev->mec_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->mec_fw, fw_name, rdev->dev);
if (err) if (err)
goto out; goto out;
if (rdev->mec_fw->size != mec_req_size) { if (rdev->mec_fw->size != mec_req_size) {
...@@ -839,7 +830,7 @@ static int cik_init_microcode(struct radeon_device *rdev) ...@@ -839,7 +830,7 @@ static int cik_init_microcode(struct radeon_device *rdev)
} }
snprintf(fw_name, sizeof(fw_name), "radeon/%s_rlc.bin", chip_name); snprintf(fw_name, sizeof(fw_name), "radeon/%s_rlc.bin", chip_name);
err = request_firmware(&rdev->rlc_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev);
if (err) if (err)
goto out; goto out;
if (rdev->rlc_fw->size != rlc_req_size) { if (rdev->rlc_fw->size != rlc_req_size) {
...@@ -850,7 +841,7 @@ static int cik_init_microcode(struct radeon_device *rdev) ...@@ -850,7 +841,7 @@ static int cik_init_microcode(struct radeon_device *rdev)
} }
snprintf(fw_name, sizeof(fw_name), "radeon/%s_sdma.bin", chip_name); snprintf(fw_name, sizeof(fw_name), "radeon/%s_sdma.bin", chip_name);
err = request_firmware(&rdev->sdma_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->sdma_fw, fw_name, rdev->dev);
if (err) if (err)
goto out; goto out;
if (rdev->sdma_fw->size != sdma_req_size) { if (rdev->sdma_fw->size != sdma_req_size) {
...@@ -863,7 +854,7 @@ static int cik_init_microcode(struct radeon_device *rdev) ...@@ -863,7 +854,7 @@ static int cik_init_microcode(struct radeon_device *rdev)
/* No MC ucode on APUs */ /* No MC ucode on APUs */
if (!(rdev->flags & RADEON_IS_IGP)) { if (!(rdev->flags & RADEON_IS_IGP)) {
snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name);
err = request_firmware(&rdev->mc_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev);
if (err) if (err)
goto out; goto out;
if (rdev->mc_fw->size != mc_req_size) { if (rdev->mc_fw->size != mc_req_size) {
...@@ -875,8 +866,6 @@ static int cik_init_microcode(struct radeon_device *rdev) ...@@ -875,8 +866,6 @@ static int cik_init_microcode(struct radeon_device *rdev)
} }
out: out:
platform_device_unregister(pdev);
if (err) { if (err) {
if (err != -EINVAL) if (err != -EINVAL)
printk(KERN_ERR printk(KERN_ERR
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
* Authors: Alex Deucher * Authors: Alex Deucher
*/ */
#include <linux/firmware.h> #include <linux/firmware.h>
#include <linux/platform_device.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/module.h>
#include <drm/drmP.h> #include <drm/drmP.h>
...@@ -684,7 +683,6 @@ int ni_mc_load_microcode(struct radeon_device *rdev) ...@@ -684,7 +683,6 @@ int ni_mc_load_microcode(struct radeon_device *rdev)
int ni_init_microcode(struct radeon_device *rdev) int ni_init_microcode(struct radeon_device *rdev)
{ {
struct platform_device *pdev;
const char *chip_name; const char *chip_name;
const char *rlc_chip_name; const char *rlc_chip_name;
size_t pfp_req_size, me_req_size, rlc_req_size, mc_req_size; size_t pfp_req_size, me_req_size, rlc_req_size, mc_req_size;
...@@ -694,13 +692,6 @@ int ni_init_microcode(struct radeon_device *rdev) ...@@ -694,13 +692,6 @@ int ni_init_microcode(struct radeon_device *rdev)
DRM_DEBUG("\n"); DRM_DEBUG("\n");
pdev = platform_device_register_simple("radeon_cp", 0, NULL, 0);
err = IS_ERR(pdev);
if (err) {
printk(KERN_ERR "radeon_cp: Failed to register firmware\n");
return -EINVAL;
}
switch (rdev->family) { switch (rdev->family) {
case CHIP_BARTS: case CHIP_BARTS:
chip_name = "BARTS"; chip_name = "BARTS";
...@@ -753,7 +744,7 @@ int ni_init_microcode(struct radeon_device *rdev) ...@@ -753,7 +744,7 @@ int ni_init_microcode(struct radeon_device *rdev)
DRM_INFO("Loading %s Microcode\n", chip_name); DRM_INFO("Loading %s Microcode\n", chip_name);
snprintf(fw_name, sizeof(fw_name), "radeon/%s_pfp.bin", chip_name); snprintf(fw_name, sizeof(fw_name), "radeon/%s_pfp.bin", chip_name);
err = request_firmware(&rdev->pfp_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev);
if (err) if (err)
goto out; goto out;
if (rdev->pfp_fw->size != pfp_req_size) { if (rdev->pfp_fw->size != pfp_req_size) {
...@@ -765,7 +756,7 @@ int ni_init_microcode(struct radeon_device *rdev) ...@@ -765,7 +756,7 @@ int ni_init_microcode(struct radeon_device *rdev)
} }
snprintf(fw_name, sizeof(fw_name), "radeon/%s_me.bin", chip_name); snprintf(fw_name, sizeof(fw_name), "radeon/%s_me.bin", chip_name);
err = request_firmware(&rdev->me_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
if (err) if (err)
goto out; goto out;
if (rdev->me_fw->size != me_req_size) { if (rdev->me_fw->size != me_req_size) {
...@@ -776,7 +767,7 @@ int ni_init_microcode(struct radeon_device *rdev) ...@@ -776,7 +767,7 @@ int ni_init_microcode(struct radeon_device *rdev)
} }
snprintf(fw_name, sizeof(fw_name), "radeon/%s_rlc.bin", rlc_chip_name); snprintf(fw_name, sizeof(fw_name), "radeon/%s_rlc.bin", rlc_chip_name);
err = request_firmware(&rdev->rlc_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev);
if (err) if (err)
goto out; goto out;
if (rdev->rlc_fw->size != rlc_req_size) { if (rdev->rlc_fw->size != rlc_req_size) {
...@@ -789,7 +780,7 @@ int ni_init_microcode(struct radeon_device *rdev) ...@@ -789,7 +780,7 @@ int ni_init_microcode(struct radeon_device *rdev)
/* no MC ucode on TN */ /* no MC ucode on TN */
if (!(rdev->flags & RADEON_IS_IGP)) { if (!(rdev->flags & RADEON_IS_IGP)) {
snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name);
err = request_firmware(&rdev->mc_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev);
if (err) if (err)
goto out; goto out;
if (rdev->mc_fw->size != mc_req_size) { if (rdev->mc_fw->size != mc_req_size) {
...@@ -802,7 +793,7 @@ int ni_init_microcode(struct radeon_device *rdev) ...@@ -802,7 +793,7 @@ int ni_init_microcode(struct radeon_device *rdev)
if ((rdev->family >= CHIP_BARTS) && (rdev->family <= CHIP_CAYMAN)) { if ((rdev->family >= CHIP_BARTS) && (rdev->family <= CHIP_CAYMAN)) {
snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name);
err = request_firmware(&rdev->smc_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
if (err) if (err)
goto out; goto out;
if (rdev->smc_fw->size != smc_req_size) { if (rdev->smc_fw->size != smc_req_size) {
...@@ -814,8 +805,6 @@ int ni_init_microcode(struct radeon_device *rdev) ...@@ -814,8 +805,6 @@ int ni_init_microcode(struct radeon_device *rdev)
} }
out: out:
platform_device_unregister(pdev);
if (err) { if (err) {
if (err != -EINVAL) if (err != -EINVAL)
printk(KERN_ERR printk(KERN_ERR
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include "atom.h" #include "atom.h"
#include <linux/firmware.h> #include <linux/firmware.h>
#include <linux/platform_device.h>
#include <linux/module.h> #include <linux/module.h>
#include "r100_reg_safe.h" #include "r100_reg_safe.h"
...@@ -989,18 +988,11 @@ void r100_ring_start(struct radeon_device *rdev, struct radeon_ring *ring) ...@@ -989,18 +988,11 @@ void r100_ring_start(struct radeon_device *rdev, struct radeon_ring *ring)
/* Load the microcode for the CP */ /* Load the microcode for the CP */
static int r100_cp_init_microcode(struct radeon_device *rdev) static int r100_cp_init_microcode(struct radeon_device *rdev)
{ {
struct platform_device *pdev;
const char *fw_name = NULL; const char *fw_name = NULL;
int err; int err;
DRM_DEBUG_KMS("\n"); DRM_DEBUG_KMS("\n");
pdev = platform_device_register_simple("radeon_cp", 0, NULL, 0);
err = IS_ERR(pdev);
if (err) {
printk(KERN_ERR "radeon_cp: Failed to register firmware\n");
return -EINVAL;
}
if ((rdev->family == CHIP_R100) || (rdev->family == CHIP_RV100) || if ((rdev->family == CHIP_R100) || (rdev->family == CHIP_RV100) ||
(rdev->family == CHIP_RV200) || (rdev->family == CHIP_RS100) || (rdev->family == CHIP_RV200) || (rdev->family == CHIP_RS100) ||
(rdev->family == CHIP_RS200)) { (rdev->family == CHIP_RS200)) {
...@@ -1042,8 +1034,7 @@ static int r100_cp_init_microcode(struct radeon_device *rdev) ...@@ -1042,8 +1034,7 @@ static int r100_cp_init_microcode(struct radeon_device *rdev)
fw_name = FIRMWARE_R520; fw_name = FIRMWARE_R520;
} }
err = request_firmware(&rdev->me_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
platform_device_unregister(pdev);
if (err) { if (err) {
printk(KERN_ERR "radeon_cp: Failed to load firmware \"%s\"\n", printk(KERN_ERR "radeon_cp: Failed to load firmware \"%s\"\n",
fw_name); fw_name);
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/firmware.h> #include <linux/firmware.h>
#include <linux/platform_device.h>
#include <linux/module.h> #include <linux/module.h>
#include <drm/drmP.h> #include <drm/drmP.h>
#include <drm/radeon_drm.h> #include <drm/radeon_drm.h>
...@@ -2144,7 +2143,6 @@ void r600_cp_stop(struct radeon_device *rdev) ...@@ -2144,7 +2143,6 @@ void r600_cp_stop(struct radeon_device *rdev)
int r600_init_microcode(struct radeon_device *rdev) int r600_init_microcode(struct radeon_device *rdev)
{ {
struct platform_device *pdev;
const char *chip_name; const char *chip_name;
const char *rlc_chip_name; const char *rlc_chip_name;
const char *smc_chip_name = "RV770"; const char *smc_chip_name = "RV770";
...@@ -2154,13 +2152,6 @@ int r600_init_microcode(struct radeon_device *rdev) ...@@ -2154,13 +2152,6 @@ int r600_init_microcode(struct radeon_device *rdev)
DRM_DEBUG("\n"); DRM_DEBUG("\n");
pdev = platform_device_register_simple("radeon_cp", 0, NULL, 0);
err = IS_ERR(pdev);
if (err) {
printk(KERN_ERR "radeon_cp: Failed to register firmware\n");
return -EINVAL;
}
switch (rdev->family) { switch (rdev->family) {
case CHIP_R600: case CHIP_R600:
chip_name = "R600"; chip_name = "R600";
...@@ -2272,7 +2263,7 @@ int r600_init_microcode(struct radeon_device *rdev) ...@@ -2272,7 +2263,7 @@ int r600_init_microcode(struct radeon_device *rdev)
DRM_INFO("Loading %s Microcode\n", chip_name); DRM_INFO("Loading %s Microcode\n", chip_name);
snprintf(fw_name, sizeof(fw_name), "radeon/%s_pfp.bin", chip_name); snprintf(fw_name, sizeof(fw_name), "radeon/%s_pfp.bin", chip_name);
err = request_firmware(&rdev->pfp_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev);
if (err) if (err)
goto out; goto out;
if (rdev->pfp_fw->size != pfp_req_size) { if (rdev->pfp_fw->size != pfp_req_size) {
...@@ -2284,7 +2275,7 @@ int r600_init_microcode(struct radeon_device *rdev) ...@@ -2284,7 +2275,7 @@ int r600_init_microcode(struct radeon_device *rdev)
} }
snprintf(fw_name, sizeof(fw_name), "radeon/%s_me.bin", chip_name); snprintf(fw_name, sizeof(fw_name), "radeon/%s_me.bin", chip_name);
err = request_firmware(&rdev->me_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
if (err) if (err)
goto out; goto out;
if (rdev->me_fw->size != me_req_size) { if (rdev->me_fw->size != me_req_size) {
...@@ -2295,7 +2286,7 @@ int r600_init_microcode(struct radeon_device *rdev) ...@@ -2295,7 +2286,7 @@ int r600_init_microcode(struct radeon_device *rdev)
} }
snprintf(fw_name, sizeof(fw_name), "radeon/%s_rlc.bin", rlc_chip_name); snprintf(fw_name, sizeof(fw_name), "radeon/%s_rlc.bin", rlc_chip_name);
err = request_firmware(&rdev->rlc_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev);
if (err) if (err)
goto out; goto out;
if (rdev->rlc_fw->size != rlc_req_size) { if (rdev->rlc_fw->size != rlc_req_size) {
...@@ -2307,7 +2298,7 @@ int r600_init_microcode(struct radeon_device *rdev) ...@@ -2307,7 +2298,7 @@ int r600_init_microcode(struct radeon_device *rdev)
if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_HEMLOCK)) { if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_HEMLOCK)) {
snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", smc_chip_name); snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", smc_chip_name);
err = request_firmware(&rdev->smc_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
if (err) if (err)
goto out; goto out;
if (rdev->smc_fw->size != smc_req_size) { if (rdev->smc_fw->size != smc_req_size) {
...@@ -2319,8 +2310,6 @@ int r600_init_microcode(struct radeon_device *rdev) ...@@ -2319,8 +2310,6 @@ int r600_init_microcode(struct radeon_device *rdev)
} }
out: out:
platform_device_unregister(pdev);
if (err) { if (err) {
if (err != -EINVAL) if (err != -EINVAL)
printk(KERN_ERR printk(KERN_ERR
......
...@@ -56,20 +56,12 @@ static void radeon_uvd_idle_work_handler(struct work_struct *work); ...@@ -56,20 +56,12 @@ static void radeon_uvd_idle_work_handler(struct work_struct *work);
int radeon_uvd_init(struct radeon_device *rdev) int radeon_uvd_init(struct radeon_device *rdev)
{ {
struct platform_device *pdev;
unsigned long bo_size; unsigned long bo_size;
const char *fw_name; const char *fw_name;
int i, r; int i, r;
INIT_DELAYED_WORK(&rdev->uvd.idle_work, radeon_uvd_idle_work_handler); INIT_DELAYED_WORK(&rdev->uvd.idle_work, radeon_uvd_idle_work_handler);
pdev = platform_device_register_simple("radeon_uvd", 0, NULL, 0);
r = IS_ERR(pdev);
if (r) {
dev_err(rdev->dev, "radeon_uvd: Failed to register firmware\n");
return -EINVAL;
}
switch (rdev->family) { switch (rdev->family) {
case CHIP_RV710: case CHIP_RV710:
case CHIP_RV730: case CHIP_RV730:
...@@ -112,16 +104,13 @@ int radeon_uvd_init(struct radeon_device *rdev) ...@@ -112,16 +104,13 @@ int radeon_uvd_init(struct radeon_device *rdev)
return -EINVAL; return -EINVAL;
} }
r = request_firmware(&rdev->uvd_fw, fw_name, &pdev->dev); r = request_firmware(&rdev->uvd_fw, fw_name, rdev->dev);
if (r) { if (r) {
dev_err(rdev->dev, "radeon_uvd: Can't load firmware \"%s\"\n", dev_err(rdev->dev, "radeon_uvd: Can't load firmware \"%s\"\n",
fw_name); fw_name);
platform_device_unregister(pdev);
return r; return r;
} }
platform_device_unregister(pdev);
bo_size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 8) + bo_size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 8) +
RADEON_UVD_STACK_SIZE + RADEON_UVD_HEAP_SIZE; RADEON_UVD_STACK_SIZE + RADEON_UVD_HEAP_SIZE;
r = radeon_bo_create(rdev, bo_size, PAGE_SIZE, true, r = radeon_bo_create(rdev, bo_size, PAGE_SIZE, true,
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
* Authors: Alex Deucher * Authors: Alex Deucher
*/ */
#include <linux/firmware.h> #include <linux/firmware.h>
#include <linux/platform_device.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/module.h>
#include <drm/drmP.h> #include <drm/drmP.h>
...@@ -1541,7 +1540,6 @@ static int si_mc_load_microcode(struct radeon_device *rdev) ...@@ -1541,7 +1540,6 @@ static int si_mc_load_microcode(struct radeon_device *rdev)
static int si_init_microcode(struct radeon_device *rdev) static int si_init_microcode(struct radeon_device *rdev)
{ {
struct platform_device *pdev;
const char *chip_name; const char *chip_name;
const char *rlc_chip_name; const char *rlc_chip_name;
size_t pfp_req_size, me_req_size, ce_req_size, rlc_req_size, mc_req_size; size_t pfp_req_size, me_req_size, ce_req_size, rlc_req_size, mc_req_size;
...@@ -1551,13 +1549,6 @@ static int si_init_microcode(struct radeon_device *rdev) ...@@ -1551,13 +1549,6 @@ static int si_init_microcode(struct radeon_device *rdev)
DRM_DEBUG("\n"); DRM_DEBUG("\n");
pdev = platform_device_register_simple("radeon_cp", 0, NULL, 0);
err = IS_ERR(pdev);
if (err) {
printk(KERN_ERR "radeon_cp: Failed to register firmware\n");
return -EINVAL;
}
switch (rdev->family) { switch (rdev->family) {
case CHIP_TAHITI: case CHIP_TAHITI:
chip_name = "TAHITI"; chip_name = "TAHITI";
...@@ -1615,7 +1606,7 @@ static int si_init_microcode(struct radeon_device *rdev) ...@@ -1615,7 +1606,7 @@ static int si_init_microcode(struct radeon_device *rdev)
DRM_INFO("Loading %s Microcode\n", chip_name); DRM_INFO("Loading %s Microcode\n", chip_name);
snprintf(fw_name, sizeof(fw_name), "radeon/%s_pfp.bin", chip_name); snprintf(fw_name, sizeof(fw_name), "radeon/%s_pfp.bin", chip_name);
err = request_firmware(&rdev->pfp_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev);
if (err) if (err)
goto out; goto out;
if (rdev->pfp_fw->size != pfp_req_size) { if (rdev->pfp_fw->size != pfp_req_size) {
...@@ -1627,7 +1618,7 @@ static int si_init_microcode(struct radeon_device *rdev) ...@@ -1627,7 +1618,7 @@ static int si_init_microcode(struct radeon_device *rdev)
} }
snprintf(fw_name, sizeof(fw_name), "radeon/%s_me.bin", chip_name); snprintf(fw_name, sizeof(fw_name), "radeon/%s_me.bin", chip_name);
err = request_firmware(&rdev->me_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
if (err) if (err)
goto out; goto out;
if (rdev->me_fw->size != me_req_size) { if (rdev->me_fw->size != me_req_size) {
...@@ -1638,7 +1629,7 @@ static int si_init_microcode(struct radeon_device *rdev) ...@@ -1638,7 +1629,7 @@ static int si_init_microcode(struct radeon_device *rdev)
} }
snprintf(fw_name, sizeof(fw_name), "radeon/%s_ce.bin", chip_name); snprintf(fw_name, sizeof(fw_name), "radeon/%s_ce.bin", chip_name);
err = request_firmware(&rdev->ce_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->ce_fw, fw_name, rdev->dev);
if (err) if (err)
goto out; goto out;
if (rdev->ce_fw->size != ce_req_size) { if (rdev->ce_fw->size != ce_req_size) {
...@@ -1649,7 +1640,7 @@ static int si_init_microcode(struct radeon_device *rdev) ...@@ -1649,7 +1640,7 @@ static int si_init_microcode(struct radeon_device *rdev)
} }
snprintf(fw_name, sizeof(fw_name), "radeon/%s_rlc.bin", rlc_chip_name); snprintf(fw_name, sizeof(fw_name), "radeon/%s_rlc.bin", rlc_chip_name);
err = request_firmware(&rdev->rlc_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev);
if (err) if (err)
goto out; goto out;
if (rdev->rlc_fw->size != rlc_req_size) { if (rdev->rlc_fw->size != rlc_req_size) {
...@@ -1660,7 +1651,7 @@ static int si_init_microcode(struct radeon_device *rdev) ...@@ -1660,7 +1651,7 @@ static int si_init_microcode(struct radeon_device *rdev)
} }
snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name);
err = request_firmware(&rdev->mc_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev);
if (err) if (err)
goto out; goto out;
if (rdev->mc_fw->size != mc_req_size) { if (rdev->mc_fw->size != mc_req_size) {
...@@ -1671,7 +1662,7 @@ static int si_init_microcode(struct radeon_device *rdev) ...@@ -1671,7 +1662,7 @@ static int si_init_microcode(struct radeon_device *rdev)
} }
snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name);
err = request_firmware(&rdev->smc_fw, fw_name, &pdev->dev); err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
if (err) if (err)
goto out; goto out;
if (rdev->smc_fw->size != smc_req_size) { if (rdev->smc_fw->size != smc_req_size) {
...@@ -1682,8 +1673,6 @@ static int si_init_microcode(struct radeon_device *rdev) ...@@ -1682,8 +1673,6 @@ static int si_init_microcode(struct radeon_device *rdev)
} }
out: out:
platform_device_unregister(pdev);
if (err) { if (err) {
if (err != -EINVAL) if (err != -EINVAL)
printk(KERN_ERR printk(KERN_ERR
......
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