1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Apple Onboard Audio GPIO definitions
5 * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
10 #include <linux/workqueue.h>
11 #include <linux/mutex.h>
14 typedef void (*notify_func_t
)(void *data
);
24 /* for initialisation/de-initialisation of the GPIO layer */
25 void (*init
)(struct gpio_runtime
*rt
);
26 void (*exit
)(struct gpio_runtime
*rt
);
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
);
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
);
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
);
43 void (*set_hw_reset
)(struct gpio_runtime
*rt
, int on
);
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
52 int (*set_notify
)(struct gpio_runtime
*rt
,
53 enum notify_type type
,
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
);
62 struct gpio_notification
{
63 struct delayed_work work
;
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
;
82 #endif /* __AOA_GPIO_H */