/* This function sets the direction of specified GPIO signal as output. If all GPIO signals of GPIO chip is configured as input then it returns error otherwise it returns 0.  */
static int xgpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
/* This function sets the direction of specified GPIO signal as output. If all GPIO signals of GPIO chip is configured as input then it returns error otherwise it returns 0.  */
static int xgpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
{
	unsigned long flags;
	struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
	struct xgpio_instance *chip =
	    container_of(mm_gc, struct xgpio_instance, mmchip);
	spin_lock_irqsave(&chip->gpio_lock, flags);
	if (val)
		chip->gpio_state |= 1 << gpio;
	else
		chip->gpio_state &= ~(1 << gpio);
	out_be32(mm_gc->regs + XGPIO_DATA_OFFSET, chip->gpio_state);
	chip->gpio_dir &= (~(1 << gpio));
	out_be32(mm_gc->regs + XGPIO_TRI_OFFSET, chip->gpio_dir);
	spin_unlock_irqrestore(&chip->gpio_lock, flags);
	return 0;
}