![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0-only */ 0002 /* 0003 * Apple Onboard Audio definitions 0004 * 0005 * Copyright 2006 Johannes Berg <johannes@sipsolutions.net> 0006 */ 0007 0008 #ifndef __AOA_H 0009 #define __AOA_H 0010 #include <asm/prom.h> 0011 #include <linux/module.h> 0012 #include <sound/core.h> 0013 #include <sound/asound.h> 0014 #include <sound/control.h> 0015 #include "aoa-gpio.h" 0016 #include "soundbus/soundbus.h" 0017 0018 #define MAX_CODEC_NAME_LEN 32 0019 0020 struct aoa_codec { 0021 char name[MAX_CODEC_NAME_LEN]; 0022 0023 struct module *owner; 0024 0025 /* called when the fabric wants to init this codec. 0026 * Do alsa card manipulations from here. */ 0027 int (*init)(struct aoa_codec *codec); 0028 0029 /* called when the fabric is done with the codec. 0030 * The alsa card will be cleaned up so don't bother. */ 0031 void (*exit)(struct aoa_codec *codec); 0032 0033 /* May be NULL, but can be used by the fabric. 0034 * Refcounting is the codec driver's responsibility */ 0035 struct device_node *node; 0036 0037 /* assigned by fabric before init() is called, points 0038 * to the soundbus device. Cannot be NULL. */ 0039 struct soundbus_dev *soundbus_dev; 0040 0041 /* assigned by the fabric before init() is called, points 0042 * to the fabric's gpio runtime record for the relevant 0043 * device. */ 0044 struct gpio_runtime *gpio; 0045 0046 /* assigned by the fabric before init() is called, contains 0047 * a codec specific bitmask of what outputs and inputs are 0048 * actually connected */ 0049 u32 connected; 0050 0051 /* data the fabric can associate with this structure */ 0052 void *fabric_data; 0053 0054 /* private! */ 0055 struct list_head list; 0056 struct aoa_fabric *fabric; 0057 }; 0058 0059 /* return 0 on success */ 0060 extern int 0061 aoa_codec_register(struct aoa_codec *codec); 0062 extern void 0063 aoa_codec_unregister(struct aoa_codec *codec); 0064 0065 #define MAX_LAYOUT_NAME_LEN 32 0066 0067 struct aoa_fabric { 0068 char name[MAX_LAYOUT_NAME_LEN]; 0069 0070 struct module *owner; 0071 0072 /* once codecs register, they are passed here after. 0073 * They are of course not initialised, since the 0074 * fabric is responsible for initialising some fields 0075 * in the codec structure! */ 0076 int (*found_codec)(struct aoa_codec *codec); 0077 /* called for each codec when it is removed, 0078 * also in the case that aoa_fabric_unregister 0079 * is called and all codecs are removed 0080 * from this fabric. 0081 * Also called if found_codec returned 0 but 0082 * the codec couldn't initialise. */ 0083 void (*remove_codec)(struct aoa_codec *codec); 0084 /* If found_codec returned 0, and the codec 0085 * could be initialised, this is called. */ 0086 void (*attached_codec)(struct aoa_codec *codec); 0087 }; 0088 0089 /* return 0 on success, -EEXIST if another fabric is 0090 * registered, -EALREADY if the same fabric is registered. 0091 * Passing NULL can be used to test for the presence 0092 * of another fabric, if -EALREADY is returned there is 0093 * no other fabric present. 0094 * In the case that the function returns -EALREADY 0095 * and the fabric passed is not NULL, all codecs 0096 * that are not assigned yet are passed to the fabric 0097 * again for reconsideration. */ 0098 extern int 0099 aoa_fabric_register(struct aoa_fabric *fabric, struct device *dev); 0100 0101 /* it is vital to call this when the fabric exits! 0102 * When calling, the remove_codec will be called 0103 * for all codecs, unless it is NULL. */ 0104 extern void 0105 aoa_fabric_unregister(struct aoa_fabric *fabric); 0106 0107 /* if for some reason you want to get rid of a codec 0108 * before the fabric is removed, use this. 0109 * Note that remove_codec is called for it! */ 0110 extern void 0111 aoa_fabric_unlink_codec(struct aoa_codec *codec); 0112 0113 /* alsa help methods */ 0114 struct aoa_card { 0115 struct snd_card *alsa_card; 0116 }; 0117 0118 extern int aoa_snd_device_new(enum snd_device_type type, 0119 void *device_data, const struct snd_device_ops *ops); 0120 extern struct snd_card *aoa_get_card(void); 0121 extern int aoa_snd_ctl_add(struct snd_kcontrol* control); 0122 0123 /* GPIO stuff */ 0124 extern struct gpio_methods *pmf_gpio_methods; 0125 extern struct gpio_methods *ftr_gpio_methods; 0126 /* extern struct gpio_methods *map_gpio_methods; */ 0127 0128 #endif /* __AOA_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |