diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2010-04-06 22:05:32 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2010-04-08 20:15:45 -0400 |
commit | 02faec09b2814b6ad3fd202e2f28b3c4b712a3f1 (patch) | |
tree | 90feb8737a8d9d95a52ef964f6b3fa4406e20797 /drivers/gpu/drm | |
parent | 2535d71c80b3d79090c9d44ec6d35342e2d258f0 (diff) |
drm/nv50: parse/use some more de-magiced parts of gpio table entries
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bios.c | 23 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bios.h | 2 |
2 files changed, 11 insertions, 14 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 84b03e0a3865..70a51fc2323e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
@@ -2595,10 +2595,7 @@ init_gpio(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2595 | r = nv50_gpio_reg[gpio->line >> 3]; | 2595 | r = nv50_gpio_reg[gpio->line >> 3]; |
2596 | s = (gpio->line & 0x07) << 2; | 2596 | s = (gpio->line & 0x07) << 2; |
2597 | v = bios_rd32(bios, r) & ~(0x00000003 << s); | 2597 | v = bios_rd32(bios, r) & ~(0x00000003 << s); |
2598 | if (gpio->entry & 0x01000000) | 2598 | v |= (gpio->state[gpio->state_default] ^ 2) << s; |
2599 | v |= (((gpio->entry & 0x60000000) >> 29) ^ 2) << s; | ||
2600 | else | ||
2601 | v |= (((gpio->entry & 0x18000000) >> 27) ^ 2) << s; | ||
2602 | bios_wr32(bios, r, v); | 2599 | bios_wr32(bios, r, v); |
2603 | 2600 | ||
2604 | r = nv50_gpio_ctl[gpio->line >> 4]; | 2601 | r = nv50_gpio_ctl[gpio->line >> 4]; |
@@ -5078,21 +5075,19 @@ parse_dcb30_gpio_entry(struct nvbios *bios, uint16_t offset) | |||
5078 | static void | 5075 | static void |
5079 | parse_dcb40_gpio_entry(struct nvbios *bios, uint16_t offset) | 5076 | parse_dcb40_gpio_entry(struct nvbios *bios, uint16_t offset) |
5080 | { | 5077 | { |
5078 | uint32_t entry = ROM32(bios->data[offset]); | ||
5081 | struct dcb_gpio_entry *gpio; | 5079 | struct dcb_gpio_entry *gpio; |
5082 | uint32_t ent = ROM32(bios->data[offset]); | ||
5083 | uint8_t line = ent & 0x1f, | ||
5084 | tag = ent >> 8 & 0xff; | ||
5085 | 5080 | ||
5086 | if (tag == 0xff) | 5081 | if ((entry & 0x0000ff00) == 0x0000ff00) |
5087 | return; | 5082 | return; |
5088 | 5083 | ||
5089 | gpio = new_gpio_entry(bios); | 5084 | gpio = new_gpio_entry(bios); |
5090 | 5085 | gpio->tag = (entry & 0x0000ff00) >> 8; | |
5091 | /* Currently unused, we may need more fields parsed at some | 5086 | gpio->line = (entry & 0x0000001f) >> 0; |
5092 | * point. */ | 5087 | gpio->state_default = (entry & 0x01000000) >> 24; |
5093 | gpio->tag = tag; | 5088 | gpio->state[0] = (entry & 0x18000000) >> 27; |
5094 | gpio->line = line; | 5089 | gpio->state[1] = (entry & 0x60000000) >> 29; |
5095 | gpio->entry = ent; | 5090 | gpio->entry = entry; |
5096 | } | 5091 | } |
5097 | 5092 | ||
5098 | static void | 5093 | static void |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.h b/drivers/gpu/drm/nouveau/nouveau_bios.h index 3706493c014d..c0d7b0a3ece0 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.h +++ b/drivers/gpu/drm/nouveau/nouveau_bios.h | |||
@@ -50,6 +50,8 @@ struct dcb_gpio_entry { | |||
50 | int line; | 50 | int line; |
51 | bool invert; | 51 | bool invert; |
52 | uint32_t entry; | 52 | uint32_t entry; |
53 | uint8_t state_default; | ||
54 | uint8_t state[2]; | ||
53 | }; | 55 | }; |
54 | 56 | ||
55 | struct dcb_gpio_table { | 57 | struct dcb_gpio_table { |