~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/aoa/aoa-gpio.h

Version: ~ [ linux-5.12-rc7 ] ~ [ linux-5.11.13 ] ~ [ linux-5.10.29 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.111 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.186 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.230 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.266 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.266 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  * Apple Onboard Audio GPIO definitions
  4  *
  5  * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
  6  */
  7 
  8 #ifndef __AOA_GPIO_H
  9 #define __AOA_GPIO_H
 10 #include <linux/workqueue.h>
 11 #include <linux/mutex.h>
 12 #include <asm/prom.h>
 13 
 14 typedef void (*notify_func_t)(void *data);
 15 
 16 enum notify_type {
 17         AOA_NOTIFY_HEADPHONE,
 18         AOA_NOTIFY_LINE_IN,
 19         AOA_NOTIFY_LINE_OUT,
 20 };
 21 
 22 struct gpio_runtime;
 23 struct gpio_methods {
 24         /* for initialisation/de-initialisation of the GPIO layer */
 25         void (*init)(struct gpio_runtime *rt);
 26         void (*exit)(struct gpio_runtime *rt);
 27 
 28         /* turn off headphone, speakers, lineout */
 29         void (*all_amps_off)(struct gpio_runtime *rt);
 30         /* turn headphone, speakers, lineout back to previous setting */
 31         void (*all_amps_restore)(struct gpio_runtime *rt);
 32 
 33         void (*set_headphone)(struct gpio_runtime *rt, int on);
 34         void (*set_speakers)(struct gpio_runtime *rt, int on);
 35         void (*set_lineout)(struct gpio_runtime *rt, int on);
 36         void (*set_master)(struct gpio_runtime *rt, int on);
 37 
 38         int (*get_headphone)(struct gpio_runtime *rt);
 39         int (*get_speakers)(struct gpio_runtime *rt);
 40         int (*get_lineout)(struct gpio_runtime *rt);
 41         int (*get_master)(struct gpio_runtime *rt);
 42 
 43         void (*set_hw_reset)(struct gpio_runtime *rt, int on);
 44 
 45         /* use this to be notified of any events. The notification
 46          * function is passed the data, and is called in process
 47          * context by the use of schedule_work.
 48          * The interface for it is that setting a function to NULL
 49          * removes it, and they return 0 if the operation succeeded,
 50          * and -EBUSY if the notification is already assigned by
 51          * someone else. */
 52         int (*set_notify)(struct gpio_runtime *rt,
 53                           enum notify_type type,
 54                           notify_func_t notify,
 55                           void *data);
 56         /* returns 0 if not plugged in, 1 if plugged in
 57          * or a negative error code */
 58         int (*get_detect)(struct gpio_runtime *rt,
 59                           enum notify_type type);
 60 };
 61 
 62 struct gpio_notification {
 63         struct delayed_work work;
 64         notify_func_t notify;
 65         void *data;
 66         void *gpio_private;
 67         struct mutex mutex;
 68 };
 69 
 70 struct gpio_runtime {
 71         /* to be assigned by fabric */
 72         struct device_node *node;
 73         /* since everyone needs this pointer anyway... */
 74         struct gpio_methods *methods;
 75         /* to be used by the gpio implementation */
 76         int implementation_private;
 77         struct gpio_notification headphone_notify;
 78         struct gpio_notification line_in_notify;
 79         struct gpio_notification line_out_notify;
 80 };
 81 
 82 #endif /* __AOA_GPIO_H */
 83 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp