Lines Matching refs:gpio
102 static u32 get_reserved(struct intel_gpio *gpio) in get_reserved() argument
104 struct drm_psb_private *dev_priv = gpio->dev_priv; in get_reserved()
108 reserved = GMBUS_REG_READ(gpio->reg) & in get_reserved()
117 struct intel_gpio *gpio = data; in get_clock() local
118 struct drm_psb_private *dev_priv = gpio->dev_priv; in get_clock()
119 u32 reserved = get_reserved(gpio); in get_clock()
120 GMBUS_REG_WRITE(gpio->reg, reserved | GPIO_CLOCK_DIR_MASK); in get_clock()
121 GMBUS_REG_WRITE(gpio->reg, reserved); in get_clock()
122 return (GMBUS_REG_READ(gpio->reg) & GPIO_CLOCK_VAL_IN) != 0; in get_clock()
127 struct intel_gpio *gpio = data; in get_data() local
128 struct drm_psb_private *dev_priv = gpio->dev_priv; in get_data()
129 u32 reserved = get_reserved(gpio); in get_data()
130 GMBUS_REG_WRITE(gpio->reg, reserved | GPIO_DATA_DIR_MASK); in get_data()
131 GMBUS_REG_WRITE(gpio->reg, reserved); in get_data()
132 return (GMBUS_REG_READ(gpio->reg) & GPIO_DATA_VAL_IN) != 0; in get_data()
137 struct intel_gpio *gpio = data; in set_clock() local
138 struct drm_psb_private *dev_priv = gpio->dev_priv; in set_clock()
139 u32 reserved = get_reserved(gpio); in set_clock()
148 GMBUS_REG_WRITE(gpio->reg, reserved | clock_bits); in set_clock()
149 GMBUS_REG_READ(gpio->reg); /* Posting */ in set_clock()
154 struct intel_gpio *gpio = data; in set_data() local
155 struct drm_psb_private *dev_priv = gpio->dev_priv; in set_data()
156 u32 reserved = get_reserved(gpio); in set_data()
165 GMBUS_REG_WRITE(gpio->reg, reserved | data_bits); in set_data()
166 GMBUS_REG_READ(gpio->reg); in set_data()
182 struct intel_gpio *gpio; in intel_gpio_create() local
187 gpio = kzalloc(sizeof(struct intel_gpio), GFP_KERNEL); in intel_gpio_create()
188 if (gpio == NULL) in intel_gpio_create()
191 gpio->reg = map_pin_to_reg[pin]; in intel_gpio_create()
192 gpio->dev_priv = dev_priv; in intel_gpio_create()
194 snprintf(gpio->adapter.name, sizeof(gpio->adapter.name), in intel_gpio_create()
196 gpio->adapter.owner = THIS_MODULE; in intel_gpio_create()
197 gpio->adapter.algo_data = &gpio->algo; in intel_gpio_create()
198 gpio->adapter.dev.parent = &dev_priv->dev->pdev->dev; in intel_gpio_create()
199 gpio->algo.setsda = set_data; in intel_gpio_create()
200 gpio->algo.setscl = set_clock; in intel_gpio_create()
201 gpio->algo.getsda = get_data; in intel_gpio_create()
202 gpio->algo.getscl = get_clock; in intel_gpio_create()
203 gpio->algo.udelay = I2C_RISEFALL_TIME; in intel_gpio_create()
204 gpio->algo.timeout = usecs_to_jiffies(2200); in intel_gpio_create()
205 gpio->algo.data = gpio; in intel_gpio_create()
207 if (i2c_bit_add_bus(&gpio->adapter)) in intel_gpio_create()
210 return &gpio->adapter; in intel_gpio_create()
213 kfree(gpio); in intel_gpio_create()
223 struct intel_gpio *gpio = container_of(adapter, in intel_i2c_quirk_xfer() local
231 set_data(gpio, 1); in intel_i2c_quirk_xfer()
232 set_clock(gpio, 1); in intel_i2c_quirk_xfer()
237 set_data(gpio, 1); in intel_i2c_quirk_xfer()
238 set_clock(gpio, 1); in intel_i2c_quirk_xfer()