Lines Matching +full:gpio +full:- +full:latch

1 // SPDX-License-Identifier: GPL-2.0
3 * GPIO driver for AMD 8111 south bridges
5 * Copyright (c) 2012 Dmitry Eremin-Solenikov
28 #include <linux/gpio/driver.h>
37 #define AMD_GPIO_LTCH_STS 0x40 /* Latch status, w1 */
80 agp->orig[offset] = ioread8(agp->pm + AMD_REG_GPIO(offset)) & in amd_gpio_request()
83 dev_dbg(&agp->pdev->dev, "Requested gpio %d, data %x\n", offset, agp->orig[offset]); in amd_gpio_request()
92 dev_dbg(&agp->pdev->dev, "Freed gpio %d, data %x\n", offset, agp->orig[offset]); in amd_gpio_free()
94 iowrite8(agp->orig[offset], agp->pm + AMD_REG_GPIO(offset)); in amd_gpio_free()
103 spin_lock_irqsave(&agp->lock, flags); in amd_gpio_set()
104 temp = ioread8(agp->pm + AMD_REG_GPIO(offset)); in amd_gpio_set()
106 iowrite8(temp, agp->pm + AMD_REG_GPIO(offset)); in amd_gpio_set()
107 spin_unlock_irqrestore(&agp->lock, flags); in amd_gpio_set()
109 dev_dbg(&agp->pdev->dev, "Setting gpio %d, value %d, reg=%02x\n", offset, !!value, temp); in amd_gpio_set()
117 temp = ioread8(agp->pm + AMD_REG_GPIO(offset)); in amd_gpio_get()
119 dev_dbg(&agp->pdev->dev, "Getting gpio %d, reg=%02x\n", offset, temp); in amd_gpio_get()
130 spin_lock_irqsave(&agp->lock, flags); in amd_gpio_dirout()
131 temp = ioread8(agp->pm + AMD_REG_GPIO(offset)); in amd_gpio_dirout()
133 iowrite8(temp, agp->pm + AMD_REG_GPIO(offset)); in amd_gpio_dirout()
134 spin_unlock_irqrestore(&agp->lock, flags); in amd_gpio_dirout()
136 dev_dbg(&agp->pdev->dev, "Dirout gpio %d, value %d, reg=%02x\n", offset, !!value, temp); in amd_gpio_dirout()
147 spin_lock_irqsave(&agp->lock, flags); in amd_gpio_dirin()
148 temp = ioread8(agp->pm + AMD_REG_GPIO(offset)); in amd_gpio_dirin()
150 iowrite8(temp, agp->pm + AMD_REG_GPIO(offset)); in amd_gpio_dirin()
151 spin_unlock_irqrestore(&agp->lock, flags); in amd_gpio_dirin()
153 dev_dbg(&agp->pdev->dev, "Dirin gpio %d, reg=%02x\n", offset, temp); in amd_gpio_dirin()
160 .label = "AMD GPIO",
162 .base = -1,
175 int err = -ENODEV; in amd_gpio_init()
179 /* We look for our device - AMD South Bridge in amd_gpio_init()
202 err = -EIO; in amd_gpio_init()
206 if (!devm_request_region(&pdev->dev, gp.pmbase + PMBASE_OFFSET, in amd_gpio_init()
207 PMBASE_SIZE, "AMD GPIO")) { in amd_gpio_init()
208 dev_err(&pdev->dev, "AMD GPIO region 0x%x already in use!\n", in amd_gpio_init()
210 err = -EBUSY; in amd_gpio_init()
215 dev_err(&pdev->dev, "Couldn't map io port into io memory\n"); in amd_gpio_init()
216 err = -ENOMEM; in amd_gpio_init()
220 gp.chip.parent = &pdev->dev; in amd_gpio_init()
224 dev_info(&pdev->dev, "AMD-8111 GPIO detected\n"); in amd_gpio_init()
227 dev_err(&pdev->dev, "GPIO registering failed (%d)\n", err); in amd_gpio_init()
249 MODULE_DESCRIPTION("GPIO driver for AMD chipsets");