/* Change the direction of a GPIO pin to input  */
static int m2s_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
/* Change the direction of a GPIO pin to input  */
static int m2s_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
{
	struct m2s_gpio_chip *m2s_chip
		= container_of(chip, struct m2s_gpio_chip, chip);
	u32 gpio_cfg;
	unsigned long f;
	spin_lock_irqsave(&m2s_chip->lock, f);
	gpio_cfg = readl(M2S_GPIO_CFG(m2s_chip->gpio_cfg, gpio));
	gpio_cfg |= GPIO_IN_REG_EN;
	gpio_cfg &= ~(GPIO_OUT_REG_EN | GPIO_OUT_BUF_EN);
	writel(gpio_cfg, M2S_GPIO_CFG(m2s_chip->gpio_cfg, gpio));
	spin_unlock_irqrestore(&m2s_chip->lock, f);
	return 0;
}