/*
* Copyright (C) 2013 Broadcom Corporation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation version 2.
*
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
* kind, whether express or implied; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/err.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pinctrl/pinctrl.h>
#include <linux/pinctrl/pinmux.h>
#include <linux/pinctrl/pinconf.h>
#include <linux/pinctrl/pinconf-generic.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include "core.h"
#include "pinctrl-utils.h"
/* Capri Pin Control Registers Definitions */
/* Function Select bits are the same for all pin control registers */
#define CAPRI_PIN_REG_F_SEL_MASK 0x0700
#define CAPRI_PIN_REG_F_SEL_SHIFT 8
/* Standard pin register */
#define CAPRI_STD_PIN_REG_DRV_STR_MASK 0x0007
#define CAPRI_STD_PIN_REG_DRV_STR_SHIFT 0
#define CAPRI_STD_PIN_REG_INPUT_DIS_MASK 0x0008
#define CAPRI_STD_PIN_REG_INPUT_DIS_SHIFT 3
#define CAPRI_STD_PIN_REG_SLEW_MASK 0x0010
#define CAPRI_STD_PIN_REG_SLEW_SHIFT 4
#define CAPRI_STD_PIN_REG_PULL_UP_MASK 0x0020
#define CAPRI_STD_PIN_REG_PULL_UP_SHIFT 5
#define CAPRI_STD_PIN_REG_PULL_DN_MASK 0x0040
#define CAPRI_STD_PIN_REG_PULL_DN_SHIFT 6
#define CAPRI_STD_PIN_REG_HYST_MASK 0x0080
#define CAPRI_STD_PIN_REG_HYST_SHIFT 7
/* I2C pin register */
#define CAPRI_I2C_PIN_REG_INPUT_DIS_MASK 0x0004
#define CAPRI_I2C_PIN_REG_INPUT_DIS_SHIFT 2
#define CAPRI_I2C_PIN_REG_SLEW_MASK 0x0008
#define CAPRI_I2C_PIN_REG_SLEW_SHIFT 3
#define CAPRI_I2C_PIN_REG_PULL_UP_STR_MASK 0x0070
#define CAPRI_I2C_PIN_REG_PULL_UP_STR_SHIFT 4
/* HDMI pin register */
#define CAPRI_HDMI_PIN_REG_INPUT_DIS_MASK 0x0008
#define CAPRI_HDMI_PIN_REG_INPUT_DIS_SHIFT 3
#define CAPRI_HDMI_PIN_REG_MODE_MASK 0x0010
#define CAPRI_HDMI_PIN_REG_MODE_SHIFT 4
/**
* capri_pin_type - types of pin register
*/
enum capri_pin_type {
CAPRI_PIN_TYPE_UNKNOWN = 0,
CAPRI_PIN_TYPE_STD,
CAPRI_PIN_TYPE_I2C,
CAPRI_PIN_TYPE_HDMI,
};
static enum capri_pin_type std_pin = CAPRI_PIN_TYPE_STD;
static enum capri_pin_type i2c_pin = CAPRI_PIN_TYPE_I2C;
static enum capri_pin_type hdmi_pin = CAPRI_PIN_TYPE_HDMI;
/**
* capri_pin_function- define pin function
*/
struct capri_pin_function {
const char *name