From: Ben Skeggs Date: Mon, 12 Sep 2011 19:32:43 +0000 (+1000) Subject: drm/nouveau/gpio: remove invert flag, use state[] everywhere X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=85a2a365216e8e4eccf826e7dcc06c6298ab5fc1;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm/nouveau/gpio: remove invert flag, use state[] everywhere Signed-off-by: Ben Skeggs --- diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 5fc201b49d30..41899eccf570 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c @@ -5834,7 +5834,8 @@ parse_dcb_gpio_table(struct nvbios *bios) e = new_gpio_entry(bios); e->tag = DCB_GPIO_TVDAC0; e->line = tvdac_gpio[1] >> 4; - e->invert = tvdac_gpio[0] & 2; + e->state[0] = !!(tvdac_gpio[0] & 2); + e->state[1] = !e->state[0]; } goto no_table; @@ -5858,7 +5859,8 @@ parse_dcb_gpio_table(struct nvbios *bios) } e->line = (e->entry & 0x001f); - e->invert = ((e->entry & 0xf800) >> 11) != 4; + e->state[0] = ((e->entry & 0xf800) >> 11) != 4; + e->state[1] = !e->state[0]; } else { e->entry = ROM32(entry[0]); e->tag = (e->entry & 0x0000ff00) >> 8; diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.h b/drivers/gpu/drm/nouveau/nouveau_bios.h index 3f36c7074d4f..a1e31ea2ecbf 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.h +++ b/drivers/gpu/drm/nouveau/nouveau_bios.h @@ -65,7 +65,6 @@ enum dcb_gpio_tag { struct dcb_gpio_entry { enum dcb_gpio_tag tag; int line; - bool invert; uint32_t entry; uint8_t state_default; uint8_t state[2]; diff --git a/drivers/gpu/drm/nouveau/nv10_gpio.c b/drivers/gpu/drm/nouveau/nv10_gpio.c index 007fc29e2f86..748c9f739116 100644 --- a/drivers/gpu/drm/nouveau/nv10_gpio.c +++ b/drivers/gpu/drm/nouveau/nv10_gpio.c @@ -68,7 +68,7 @@ nv10_gpio_get(struct drm_device *dev, enum dcb_gpio_tag tag) value = NVReadCRTC(dev, 0, reg) >> shift; - return (ent->invert ? 1 : 0) ^ (value & 1); + return (value & 1) == ent->state[1]; } int @@ -83,7 +83,7 @@ nv10_gpio_set(struct drm_device *dev, enum dcb_gpio_tag tag, int state) if (!get_gpio_location(ent, ®, &shift, &mask)) return -ENODEV; - value = ((ent->invert ? 1 : 0) ^ (state ? 1 : 0)) << shift; + value = ent->state[state & 1] << shift; mask = ~(mask << shift); NVWriteCRTC(dev, 0, reg, value | (NVReadCRTC(dev, 0, reg) & mask));