Lines Matching refs:gpio

53 	struct gpio *gpio,
56 return dal_gpio_open_ex(gpio, mode);
60 struct gpio *gpio,
63 if (gpio->pin) {
68 // No action if allocation failed during gpio construct
69 if (!gpio->hw_container.ddc) {
73 gpio->mode = mode;
75 return dal_gpio_service_open(gpio);
79 const struct gpio *gpio,
82 if (!gpio->pin) {
87 return gpio->pin->funcs->get_value(gpio->pin, value);
91 const struct gpio *gpio,
94 if (!gpio->pin) {
99 return gpio->pin->funcs->set_value(gpio->pin, value);
103 const struct gpio *gpio)
105 return gpio->mode;
109 struct gpio *gpio)
111 return dal_gpio_service_lock(gpio->service, gpio->id, gpio->en);
115 struct gpio *gpio)
117 return dal_gpio_service_unlock(gpio->service, gpio->id, gpio->en);
121 struct gpio *gpio,
124 if (!gpio->pin) {
129 return gpio->pin->funcs->change_mode(gpio->pin, mode);
133 const struct gpio *gpio)
135 return gpio->id;
139 const struct gpio *gpio)
141 return gpio->en;
145 struct gpio *gpio,
148 if (!gpio->pin) {
153 return gpio->pin->funcs->set_config(gpio->pin, config_data);
157 const struct gpio *gpio,
160 return gpio->service->translate.funcs->id_to_offset(
161 gpio->id, gpio->en, pin_info) ?
166 const struct gpio *gpio)
168 switch (gpio->id) {
170 switch (gpio->en) {
188 switch (gpio->en) {
202 switch (gpio->en) {
212 switch (gpio->en) {
231 const struct gpio *gpio)
233 return gpio->output_state;
236 struct hw_ddc *dal_gpio_get_ddc(struct gpio *gpio)
238 return gpio->hw_container.ddc;
241 struct hw_hpd *dal_gpio_get_hpd(struct gpio *gpio)
243 return gpio->hw_container.hpd;
246 struct hw_generic *dal_gpio_get_generic(struct gpio *gpio)
248 return gpio->hw_container.generic;
252 struct gpio *gpio)
254 if (!gpio)
257 dal_gpio_service_close(gpio->service, &gpio->pin);
259 gpio->mode = GPIO_MODE_UNKNOWN;
267 struct gpio *dal_gpio_create(
273 struct gpio *gpio = kzalloc(sizeof(struct gpio), GFP_KERNEL);
275 if (!gpio) {
280 gpio->service = service;
281 gpio->pin = NULL;
282 gpio->id = id;
283 gpio->en = en;
284 gpio->mode = GPIO_MODE_UNKNOWN;
285 gpio->output_state = output_state;
288 switch (gpio->id) {
290 gpio->service->factory.funcs->init_ddc_data(&gpio->hw_container.ddc, service->ctx, id, en);
293 gpio->service->factory.funcs->init_ddc_data(&gpio->hw_container.ddc, service->ctx, id, en);
296 gpio->service->factory.funcs->init_generic(&gpio->hw_container.generic, service->ctx, id, en);
299 gpio->service->factory.funcs->init_hpd(&gpio->hw_container.hpd, service->ctx, id, en);
301 // TODO: currently gpio for sync and gsl does not get created, might need it later
308 gpio->pin = NULL;
311 return gpio;
315 struct gpio **gpio)
317 if (!gpio || !*gpio) {
322 switch ((*gpio)->id) {
324 kfree((*gpio)->hw_container.ddc);
325 (*gpio)->hw_container.ddc = NULL;
329 kfree((*gpio)->hw_container.ddc);
330 (*gpio)->hw_container.ddc = NULL;
333 kfree((*gpio)->hw_container.generic);
334 (*gpio)->hw_container.generic = NULL;
337 kfree((*gpio)->hw_container.hpd);
338 (*gpio)->hw_container.hpd = NULL;
340 // TODO: currently gpio for sync and gsl does not get created, might need it later
349 kfree(*gpio);
351 *gpio = NULL;