diff options
author | Mathias Fröhlich <Mathias.Froehlich@gmx.net> | 2009-10-27 15:08:01 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-10-27 23:34:21 -0400 |
commit | 61c4b24b3e3bb83bfe29f24fe566281b4f722237 (patch) | |
tree | cdb0a2ade5d601010d7ec9faada2336542e501ea /drivers/gpu | |
parent | d56ef9c8fd34ed29ffae27598a864b4a9a82521b (diff) |
drm/radeon/kms/atom: Make card_info per device
Make the struct card_info, which is a per struct radeon_device dataset, a
struct member of the radeon device instead of a static per kernel module
value. This should avoid potential problems with two radeon cards installed in
one system.
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_device.c | 29 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_mode.h | 1 |
2 files changed, 18 insertions, 12 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index d1cdda9b5586..88c19070247f 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -443,20 +443,24 @@ static uint32_t cail_reg_read(struct card_info *info, uint32_t reg) | |||
443 | return r; | 443 | return r; |
444 | } | 444 | } |
445 | 445 | ||
446 | static struct card_info atom_card_info = { | ||
447 | .dev = NULL, | ||
448 | .reg_read = cail_reg_read, | ||
449 | .reg_write = cail_reg_write, | ||
450 | .mc_read = cail_mc_read, | ||
451 | .mc_write = cail_mc_write, | ||
452 | .pll_read = cail_pll_read, | ||
453 | .pll_write = cail_pll_write, | ||
454 | }; | ||
455 | |||
456 | int radeon_atombios_init(struct radeon_device *rdev) | 446 | int radeon_atombios_init(struct radeon_device *rdev) |
457 | { | 447 | { |
458 | atom_card_info.dev = rdev->ddev; | 448 | struct card_info *atom_card_info = |
459 | rdev->mode_info.atom_context = atom_parse(&atom_card_info, rdev->bios); | 449 | kzalloc(sizeof(struct card_info), GFP_KERNEL); |
450 | |||
451 | if (!atom_card_info) | ||
452 | return -ENOMEM; | ||
453 | |||
454 | rdev->mode_info.atom_card_info = atom_card_info; | ||
455 | atom_card_info->dev = rdev->ddev; | ||
456 | atom_card_info->reg_read = cail_reg_read; | ||
457 | atom_card_info->reg_write = cail_reg_write; | ||
458 | atom_card_info->mc_read = cail_mc_read; | ||
459 | atom_card_info->mc_write = cail_mc_write; | ||
460 | atom_card_info->pll_read = cail_pll_read; | ||
461 | atom_card_info->pll_write = cail_pll_write; | ||
462 | |||
463 | rdev->mode_info.atom_context = atom_parse(atom_card_info, rdev->bios); | ||
460 | radeon_atom_initialize_bios_scratch_regs(rdev->ddev); | 464 | radeon_atom_initialize_bios_scratch_regs(rdev->ddev); |
461 | return 0; | 465 | return 0; |
462 | } | 466 | } |
@@ -464,6 +468,7 @@ int radeon_atombios_init(struct radeon_device *rdev) | |||
464 | void radeon_atombios_fini(struct radeon_device *rdev) | 468 | void radeon_atombios_fini(struct radeon_device *rdev) |
465 | { | 469 | { |
466 | kfree(rdev->mode_info.atom_context); | 470 | kfree(rdev->mode_info.atom_context); |
471 | kfree(rdev->mode_info.atom_card_info); | ||
467 | } | 472 | } |
468 | 473 | ||
469 | int radeon_combios_init(struct radeon_device *rdev) | 474 | int radeon_combios_init(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 2ea5707c018c..ccb783868ad6 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
@@ -172,6 +172,7 @@ enum radeon_connector_table { | |||
172 | 172 | ||
173 | struct radeon_mode_info { | 173 | struct radeon_mode_info { |
174 | struct atom_context *atom_context; | 174 | struct atom_context *atom_context; |
175 | struct card_info *atom_card_info; | ||
175 | enum radeon_connector_table connector_table; | 176 | enum radeon_connector_table connector_table; |
176 | bool mode_config_initialized; | 177 | bool mode_config_initialized; |
177 | struct radeon_crtc *crtcs[2]; | 178 | struct radeon_crtc *crtcs[2]; |