Lines Matching refs:pld
35 struct kempld_device_data *pld; member
42 static void kempld_gpio_bitop(struct kempld_device_data *pld, in kempld_gpio_bitop() argument
47 status = kempld_read8(pld, reg); in kempld_gpio_bitop()
52 kempld_write8(pld, reg, status); in kempld_gpio_bitop()
55 static int kempld_gpio_get_bit(struct kempld_device_data *pld, u8 reg, u8 bit) in kempld_gpio_get_bit() argument
59 kempld_get_mutex(pld); in kempld_gpio_get_bit()
60 status = kempld_read8(pld, reg); in kempld_gpio_get_bit()
61 kempld_release_mutex(pld); in kempld_gpio_get_bit()
69 struct kempld_device_data *pld = gpio->pld; in kempld_gpio_get() local
71 return !!kempld_gpio_get_bit(pld, KEMPLD_GPIO_LVL_NUM(offset), offset); in kempld_gpio_get()
77 struct kempld_device_data *pld = gpio->pld; in kempld_gpio_set() local
79 kempld_get_mutex(pld); in kempld_gpio_set()
80 kempld_gpio_bitop(pld, KEMPLD_GPIO_LVL_NUM(offset), offset, value); in kempld_gpio_set()
81 kempld_release_mutex(pld); in kempld_gpio_set()
87 struct kempld_device_data *pld = gpio->pld; in kempld_gpio_direction_input() local
89 kempld_get_mutex(pld); in kempld_gpio_direction_input()
90 kempld_gpio_bitop(pld, KEMPLD_GPIO_DIR_NUM(offset), offset, 0); in kempld_gpio_direction_input()
91 kempld_release_mutex(pld); in kempld_gpio_direction_input()
100 struct kempld_device_data *pld = gpio->pld; in kempld_gpio_direction_output() local
102 kempld_get_mutex(pld); in kempld_gpio_direction_output()
103 kempld_gpio_bitop(pld, KEMPLD_GPIO_LVL_NUM(offset), offset, value); in kempld_gpio_direction_output()
104 kempld_gpio_bitop(pld, KEMPLD_GPIO_DIR_NUM(offset), offset, 1); in kempld_gpio_direction_output()
105 kempld_release_mutex(pld); in kempld_gpio_direction_output()
113 struct kempld_device_data *pld = gpio->pld; in kempld_gpio_get_direction() local
115 return !kempld_gpio_get_bit(pld, KEMPLD_GPIO_DIR_NUM(offset), offset); in kempld_gpio_get_direction()
118 static int kempld_gpio_pincount(struct kempld_device_data *pld) in kempld_gpio_pincount() argument
122 kempld_get_mutex(pld); in kempld_gpio_pincount()
125 evt_back = kempld_read16(pld, KEMPLD_GPIO_EVT_LVL_EDGE); in kempld_gpio_pincount()
127 kempld_write16(pld, KEMPLD_GPIO_EVT_LVL_EDGE, 0x0000); in kempld_gpio_pincount()
129 evt = kempld_read16(pld, KEMPLD_GPIO_EVT_LVL_EDGE); in kempld_gpio_pincount()
131 kempld_write16(pld, KEMPLD_GPIO_EVT_LVL_EDGE, evt_back); in kempld_gpio_pincount()
133 kempld_release_mutex(pld); in kempld_gpio_pincount()
141 struct kempld_device_data *pld = dev_get_drvdata(dev->parent); in kempld_gpio_probe() local
142 struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); in kempld_gpio_probe()
147 if (pld->info.spec_major < 2) { in kempld_gpio_probe()
157 gpio->pld = pld; in kempld_gpio_probe()
175 chip->ngpio = kempld_gpio_pincount(pld); in kempld_gpio_probe()