Lines Matching refs:gs
125 static int mlxbf2_gpio_lock_acquire(struct mlxbf2_gpio_context *gs) in mlxbf2_gpio_lock_acquire() argument
130 spin_lock(&gs->gc.bgpio_lock); in mlxbf2_gpio_lock_acquire()
138 spin_unlock(&gs->gc.bgpio_lock); in mlxbf2_gpio_lock_acquire()
151 static void mlxbf2_gpio_lock_release(struct mlxbf2_gpio_context *gs) in mlxbf2_gpio_lock_release() argument
152 __releases(&gs->gc.bgpio_lock) in mlxbf2_gpio_lock_release()
156 spin_unlock(&gs->gc.bgpio_lock); in mlxbf2_gpio_lock_release()
181 struct mlxbf2_gpio_context *gs = gpiochip_get_data(chip); in mlxbf2_gpio_direction_input() local
188 ret = mlxbf2_gpio_lock_acquire(gs); in mlxbf2_gpio_direction_input()
192 writel(BIT(offset), gs->gpio_io + YU_GPIO_MODE0_CLEAR); in mlxbf2_gpio_direction_input()
193 writel(BIT(offset), gs->gpio_io + YU_GPIO_MODE1_CLEAR); in mlxbf2_gpio_direction_input()
195 mlxbf2_gpio_lock_release(gs); in mlxbf2_gpio_direction_input()
208 struct mlxbf2_gpio_context *gs = gpiochip_get_data(chip); in mlxbf2_gpio_direction_output() local
216 ret = mlxbf2_gpio_lock_acquire(gs); in mlxbf2_gpio_direction_output()
220 writel(BIT(offset), gs->gpio_io + YU_GPIO_MODE1_CLEAR); in mlxbf2_gpio_direction_output()
221 writel(BIT(offset), gs->gpio_io + YU_GPIO_MODE0_SET); in mlxbf2_gpio_direction_output()
223 mlxbf2_gpio_lock_release(gs); in mlxbf2_gpio_direction_output()
232 struct mlxbf2_gpio_context *gs; in mlxbf2_gpio_probe() local
239 gs = devm_kzalloc(dev, sizeof(*gs), GFP_KERNEL); in mlxbf2_gpio_probe()
240 if (!gs) in mlxbf2_gpio_probe()
248 gs->gpio_io = devm_ioremap(dev, res->start, resource_size(res)); in mlxbf2_gpio_probe()
249 if (!gs->gpio_io) in mlxbf2_gpio_probe()
261 gc = &gs->gc; in mlxbf2_gpio_probe()
264 gs->gpio_io + YU_GPIO_DATAIN, in mlxbf2_gpio_probe()
265 gs->gpio_io + YU_GPIO_DATASET, in mlxbf2_gpio_probe()
266 gs->gpio_io + YU_GPIO_DATACLEAR, in mlxbf2_gpio_probe()
281 platform_set_drvdata(pdev, gs); in mlxbf2_gpio_probe()
283 ret = devm_gpiochip_add_data(dev, &gs->gc, gs); in mlxbf2_gpio_probe()
296 struct mlxbf2_gpio_context *gs = platform_get_drvdata(pdev); in mlxbf2_gpio_suspend() local
298 gs->csave_regs->gpio_mode0 = readl(gs->gpio_io + in mlxbf2_gpio_suspend()
300 gs->csave_regs->gpio_mode1 = readl(gs->gpio_io + in mlxbf2_gpio_suspend()
308 struct mlxbf2_gpio_context *gs = platform_get_drvdata(pdev); in mlxbf2_gpio_resume() local
310 writel(gs->csave_regs->gpio_mode0, gs->gpio_io + in mlxbf2_gpio_resume()
312 writel(gs->csave_regs->gpio_mode1, gs->gpio_io + in mlxbf2_gpio_resume()