forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This large patch adds all of snd-aoa. Consisting of many modules, it currently replaces snd-powermac for all layout-id based machines and handles many more (for example new powerbooks and powermacs with digital output that previously couldn't be used at all). It also has support for all layout-IDs that Apple has (judging from their Info.plist file) but not all are tested. The driver currently has 2 known regressions over snd-powermac: * it doesn't handle powermac 7,2 and 7,3 * it doesn't have a DRC control on snapper-based machines I will fix those during the 2.6.18 development cycle. Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
- Loading branch information
Showing
35 changed files
with
7,009 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
menu "Apple Onboard Audio driver" | ||
depends on SND != n && PPC | ||
|
||
config SND_AOA | ||
tristate "Apple Onboard Audio driver" | ||
depends on SOUND && SND_PCM | ||
---help--- | ||
This option enables the new driver for the various | ||
Apple Onboard Audio components. | ||
|
||
source "sound/aoa/fabrics/Kconfig" | ||
|
||
source "sound/aoa/codecs/Kconfig" | ||
|
||
source "sound/aoa/soundbus/Kconfig" | ||
|
||
endmenu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
obj-$(CONFIG_SND_AOA) += core/ | ||
obj-$(CONFIG_SND_AOA) += codecs/ | ||
obj-$(CONFIG_SND_AOA) += fabrics/ | ||
obj-$(CONFIG_SND_AOA_SOUNDBUS) += soundbus/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Apple Onboard Audio GPIO definitions | ||
* | ||
* Copyright 2006 Johannes Berg <[email protected]> | ||
* | ||
* GPL v2, can be found in COPYING. | ||
*/ | ||
|
||
#ifndef __AOA_GPIO_H | ||
#define __AOA_GPIO_H | ||
#include <linux/workqueue.h> | ||
#include <linux/mutex.h> | ||
#include <asm/prom.h> | ||
|
||
typedef void (*notify_func_t)(void *data); | ||
|
||
enum notify_type { | ||
AOA_NOTIFY_HEADPHONE, | ||
AOA_NOTIFY_LINE_IN, | ||
AOA_NOTIFY_LINE_OUT, | ||
}; | ||
|
||
struct gpio_runtime; | ||
struct gpio_methods { | ||
/* for initialisation/de-initialisation of the GPIO layer */ | ||
void (*init)(struct gpio_runtime *rt); | ||
void (*exit)(struct gpio_runtime *rt); | ||
|
||
/* turn off headphone, speakers, lineout */ | ||
void (*all_amps_off)(struct gpio_runtime *rt); | ||
/* turn headphone, speakers, lineout back to previous setting */ | ||
void (*all_amps_restore)(struct gpio_runtime *rt); | ||
|
||
void (*set_headphone)(struct gpio_runtime *rt, int on); | ||
void (*set_speakers)(struct gpio_runtime *rt, int on); | ||
void (*set_lineout)(struct gpio_runtime *rt, int on); | ||
|
||
int (*get_headphone)(struct gpio_runtime *rt); | ||
int (*get_speakers)(struct gpio_runtime *rt); | ||
int (*get_lineout)(struct gpio_runtime *rt); | ||
|
||
void (*set_hw_reset)(struct gpio_runtime *rt, int on); | ||
|
||
/* use this to be notified of any events. The notification | ||
* function is passed the data, and is called in process | ||
* context by the use of schedule_work. | ||
* The interface for it is that setting a function to NULL | ||
* removes it, and they return 0 if the operation succeeded, | ||
* and -EBUSY if the notification is already assigned by | ||
* someone else. */ | ||
int (*set_notify)(struct gpio_runtime *rt, | ||
enum notify_type type, | ||
notify_func_t notify, | ||
void *data); | ||
/* returns 0 if not plugged in, 1 if plugged in | ||
* or a negative error code */ | ||
int (*get_detect)(struct gpio_runtime *rt, | ||
enum notify_type type); | ||
}; | ||
|
||
struct gpio_notification { | ||
notify_func_t notify; | ||
void *data; | ||
void *gpio_private; | ||
struct work_struct work; | ||
struct mutex mutex; | ||
}; | ||
|
||
struct gpio_runtime { | ||
/* to be assigned by fabric */ | ||
struct device_node *node; | ||
/* since everyone needs this pointer anyway... */ | ||
struct gpio_methods *methods; | ||
/* to be used by the gpio implementation */ | ||
int implementation_private; | ||
struct gpio_notification headphone_notify; | ||
struct gpio_notification line_in_notify; | ||
struct gpio_notification line_out_notify; | ||
}; | ||
|
||
#endif /* __AOA_GPIO_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
/* | ||
* Apple Onboard Audio definitions | ||
* | ||
* Copyright 2006 Johannes Berg <[email protected]> | ||
* | ||
* GPL v2, can be found in COPYING. | ||
*/ | ||
|
||
#ifndef __AOA_H | ||
#define __AOA_H | ||
#include <asm/prom.h> | ||
#include <linux/module.h> | ||
/* So apparently there's a reason for requiring driver.h to be included first! */ | ||
#include <sound/driver.h> | ||
#include <sound/core.h> | ||
#include <sound/asound.h> | ||
#include <sound/control.h> | ||
#include "aoa-gpio.h" | ||
#include "soundbus/soundbus.h" | ||
|
||
#define MAX_CODEC_NAME_LEN 32 | ||
|
||
struct aoa_codec { | ||
char name[MAX_CODEC_NAME_LEN]; | ||
|
||
struct module *owner; | ||
|
||
/* called when the fabric wants to init this codec. | ||
* Do alsa card manipulations from here. */ | ||
int (*init)(struct aoa_codec *codec); | ||
|
||
/* called when the fabric is done with the codec. | ||
* The alsa card will be cleaned up so don't bother. */ | ||
void (*exit)(struct aoa_codec *codec); | ||
|
||
/* May be NULL, but can be used by the fabric. | ||
* Refcounting is the codec driver's responsibility */ | ||
struct device_node *node; | ||
|
||
/* assigned by fabric before init() is called, points | ||
* to the soundbus device. Cannot be NULL. */ | ||
struct soundbus_dev *soundbus_dev; | ||
|
||
/* assigned by the fabric before init() is called, points | ||
* to the fabric's gpio runtime record for the relevant | ||
* device. */ | ||
struct gpio_runtime *gpio; | ||
|
||
/* assigned by the fabric before init() is called, contains | ||
* a codec specific bitmask of what outputs and inputs are | ||
* actually connected */ | ||
u32 connected; | ||
|
||
/* data the fabric can associate with this structure */ | ||
void *fabric_data; | ||
|
||
/* private! */ | ||
struct list_head list; | ||
struct aoa_fabric *fabric; | ||
}; | ||
|
||
/* return 0 on success */ | ||
extern int | ||
aoa_codec_register(struct aoa_codec *codec); | ||
extern void | ||
aoa_codec_unregister(struct aoa_codec *codec); | ||
|
||
#define MAX_LAYOUT_NAME_LEN 32 | ||
|
||
struct aoa_fabric { | ||
char name[MAX_LAYOUT_NAME_LEN]; | ||
|
||
struct module *owner; | ||
|
||
/* once codecs register, they are passed here after. | ||
* They are of course not initialised, since the | ||
* fabric is responsible for initialising some fields | ||
* in the codec structure! */ | ||
int (*found_codec)(struct aoa_codec *codec); | ||
/* called for each codec when it is removed, | ||
* also in the case that aoa_fabric_unregister | ||
* is called and all codecs are removed | ||
* from this fabric. | ||
* Also called if found_codec returned 0 but | ||
* the codec couldn't initialise. */ | ||
void (*remove_codec)(struct aoa_codec *codec); | ||
/* If found_codec returned 0, and the codec | ||
* could be initialised, this is called. */ | ||
void (*attached_codec)(struct aoa_codec *codec); | ||
}; | ||
|
||
/* return 0 on success, -EEXIST if another fabric is | ||
* registered, -EALREADY if the same fabric is registered. | ||
* Passing NULL can be used to test for the presence | ||
* of another fabric, if -EALREADY is returned there is | ||
* no other fabric present. | ||
* In the case that the function returns -EALREADY | ||
* and the fabric passed is not NULL, all codecs | ||
* that are not assigned yet are passed to the fabric | ||
* again for reconsideration. */ | ||
extern int | ||
aoa_fabric_register(struct aoa_fabric *fabric); | ||
|
||
/* it is vital to call this when the fabric exits! | ||
* When calling, the remove_codec will be called | ||
* for all codecs, unless it is NULL. */ | ||
extern void | ||
aoa_fabric_unregister(struct aoa_fabric *fabric); | ||
|
||
/* if for some reason you want to get rid of a codec | ||
* before the fabric is removed, use this. | ||
* Note that remove_codec is called for it! */ | ||
extern void | ||
aoa_fabric_unlink_codec(struct aoa_codec *codec); | ||
|
||
/* alsa help methods */ | ||
struct aoa_card { | ||
struct snd_card *alsa_card; | ||
}; | ||
|
||
extern int aoa_snd_device_new(snd_device_type_t type, | ||
void * device_data, struct snd_device_ops * ops); | ||
extern struct snd_card *aoa_get_card(void); | ||
extern int aoa_snd_ctl_add(struct snd_kcontrol* control); | ||
|
||
/* GPIO stuff */ | ||
extern struct gpio_methods *pmf_gpio_methods; | ||
extern struct gpio_methods *ftr_gpio_methods; | ||
/* extern struct gpio_methods *map_gpio_methods; */ | ||
|
||
#endif /* __AOA_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
config SND_AOA_ONYX | ||
tristate "support Onyx chip" | ||
depends on SND_AOA | ||
---help--- | ||
This option enables support for the Onyx (pcm3052) | ||
codec chip found in the latest Apple machines | ||
(most of those with digital audio output). | ||
|
||
#config SND_AOA_TOPAZ | ||
# tristate "support Topaz chips" | ||
# depends on SND_AOA | ||
# ---help--- | ||
# This option enables support for the Topaz (CS84xx) | ||
# codec chips found in the latest Apple machines, | ||
# these chips do the digital input and output on | ||
# some PowerMacs. | ||
|
||
config SND_AOA_TAS | ||
tristate "support TAS chips" | ||
depends on SND_AOA | ||
---help--- | ||
This option enables support for the tas chips | ||
found in a lot of Apple Machines, especially | ||
iBooks and PowerBooks without digital. | ||
|
||
config SND_AOA_TOONIE | ||
tristate "support Toonie chip" | ||
depends on SND_AOA | ||
---help--- | ||
This option enables support for the toonie codec | ||
found in the Mac Mini. If you have a Mac Mini and | ||
want to hear sound, select this option. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
obj-$(CONFIG_SND_AOA_ONYX) += snd-aoa-codec-onyx.o | ||
obj-$(CONFIG_SND_AOA_TAS) += snd-aoa-codec-tas.o | ||
obj-$(CONFIG_SND_AOA_TOONIE) += snd-aoa-codec-toonie.o |
Oops, something went wrong.