Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'topic/aoa' into for-linus

+99 -23
+2
sound/aoa/aoa-gpio.h
··· 34 34 void (*set_headphone)(struct gpio_runtime *rt, int on); 35 35 void (*set_speakers)(struct gpio_runtime *rt, int on); 36 36 void (*set_lineout)(struct gpio_runtime *rt, int on); 37 + void (*set_master)(struct gpio_runtime *rt, int on); 37 38 38 39 int (*get_headphone)(struct gpio_runtime *rt); 39 40 int (*get_speakers)(struct gpio_runtime *rt); 40 41 int (*get_lineout)(struct gpio_runtime *rt); 42 + int (*get_master)(struct gpio_runtime *rt); 41 43 42 44 void (*set_hw_reset)(struct gpio_runtime *rt, int on); 43 45
+16 -1
sound/aoa/core/gpio-feature.c
··· 14 14 #include <linux/interrupt.h> 15 15 #include "../aoa.h" 16 16 17 - /* TODO: these are 20 global variables 17 + /* TODO: these are lots of global variables 18 18 * that aren't used on most machines... 19 19 * Move them into a dynamically allocated 20 20 * structure and use that. ··· 23 23 /* these are the GPIO numbers (register addresses as offsets into 24 24 * the GPIO space) */ 25 25 static int headphone_mute_gpio; 26 + static int master_mute_gpio; 26 27 static int amp_mute_gpio; 27 28 static int lineout_mute_gpio; 28 29 static int hw_reset_gpio; ··· 33 32 34 33 /* see the SWITCH_GPIO macro */ 35 34 static int headphone_mute_gpio_activestate; 35 + static int master_mute_gpio_activestate; 36 36 static int amp_mute_gpio_activestate; 37 37 static int lineout_mute_gpio_activestate; 38 38 static int hw_reset_gpio_activestate; ··· 158 156 FTR_GPIO(headphone, 0); 159 157 FTR_GPIO(amp, 1); 160 158 FTR_GPIO(lineout, 2); 159 + FTR_GPIO(master, 3); 161 160 162 161 static void ftr_gpio_set_hw_reset(struct gpio_runtime *rt, int on) 163 162 { ··· 175 172 hw_reset_gpio, v); 176 173 } 177 174 175 + static struct gpio_methods methods; 176 + 178 177 static void ftr_gpio_all_amps_off(struct gpio_runtime *rt) 179 178 { 180 179 int saved; ··· 186 181 ftr_gpio_set_headphone(rt, 0); 187 182 ftr_gpio_set_amp(rt, 0); 188 183 ftr_gpio_set_lineout(rt, 0); 184 + if (methods.set_master) 185 + ftr_gpio_set_master(rt, 0); 189 186 rt->implementation_private = saved; 190 187 } 191 188 ··· 200 193 ftr_gpio_set_headphone(rt, (s>>0)&1); 201 194 ftr_gpio_set_amp(rt, (s>>1)&1); 202 195 ftr_gpio_set_lineout(rt, (s>>2)&1); 196 + if (methods.set_master) 197 + ftr_gpio_set_master(rt, (s>>3)&1); 203 198 } 204 199 205 200 static void ftr_handle_notify(struct work_struct *work) ··· 240 231 get_gpio("hw-reset", "audio-hw-reset", 241 232 &hw_reset_gpio, 242 233 &hw_reset_gpio_activestate); 234 + if (get_gpio("master-mute", NULL, 235 + &master_mute_gpio, 236 + &master_mute_gpio_activestate)) { 237 + methods.set_master = ftr_gpio_set_master; 238 + methods.get_master = ftr_gpio_get_master; 239 + } 243 240 244 241 headphone_detect_node = get_gpio("headphone-detect", NULL, 245 242 &headphone_detect_gpio,
+64 -17
sound/aoa/fabrics/layout.c
··· 1 1 /* 2 - * Apple Onboard Audio driver -- layout fabric 2 + * Apple Onboard Audio driver -- layout/machine id fabric 3 3 * 4 - * Copyright 2006 Johannes Berg <johannes@sipsolutions.net> 4 + * Copyright 2006-2008 Johannes Berg <johannes@sipsolutions.net> 5 5 * 6 6 * GPL v2, can be found in COPYING. 7 7 * 8 8 * 9 - * This fabric module looks for sound codecs 10 - * based on the layout-id property in the device tree. 11 - * 9 + * This fabric module looks for sound codecs based on the 10 + * layout-id or device-id property in the device tree. 12 11 */ 13 - 14 12 #include <asm/prom.h> 15 13 #include <linux/list.h> 16 14 #include <linux/module.h> ··· 61 63 #define LAYOUT_FLAG_COMBO_LINEOUT_SPDIF (1<<0) 62 64 63 65 struct layout { 64 - unsigned int layout_id; 66 + unsigned int layout_id, device_id; 65 67 struct codec_connect_info codecs[MAX_CODECS_PER_BUS]; 66 68 int flags; 67 69 ··· 108 110 MODULE_ALIAS("sound-layout-96"); 109 111 MODULE_ALIAS("sound-layout-98"); 110 112 MODULE_ALIAS("sound-layout-100"); 113 + 114 + MODULE_ALIAS("aoa-device-id-14"); 115 + MODULE_ALIAS("aoa-device-id-22"); 116 + MODULE_ALIAS("aoa-device-id-35"); 111 117 112 118 /* onyx with all but microphone connected */ 113 119 static struct codec_connection onyx_connections_nomic[] = { ··· 520 518 .connections = onyx_connections_noheadphones, 521 519 }, 522 520 }, 521 + /* PowerMac3,4 */ 522 + { .device_id = 14, 523 + .codecs[0] = { 524 + .name = "tas", 525 + .connections = tas_connections_noline, 526 + }, 527 + }, 528 + /* PowerMac3,6 */ 529 + { .device_id = 22, 530 + .codecs[0] = { 531 + .name = "tas", 532 + .connections = tas_connections_all, 533 + }, 534 + }, 535 + /* PowerBook5,2 */ 536 + { .device_id = 35, 537 + .codecs[0] = { 538 + .name = "tas", 539 + .connections = tas_connections_all, 540 + }, 541 + }, 523 542 {} 524 543 }; 525 544 ··· 549 526 struct layout *l; 550 527 551 528 l = layouts; 552 - while (l->layout_id) { 529 + while (l->codecs[0].name) { 553 530 if (l->layout_id == id) 531 + return l; 532 + l++; 533 + } 534 + return NULL; 535 + } 536 + 537 + static struct layout *find_layout_by_device(unsigned int id) 538 + { 539 + struct layout *l; 540 + 541 + l = layouts; 542 + while (l->codecs[0].name) { 543 + if (l->device_id == id) 554 544 return l; 555 545 l++; 556 546 } ··· 600 564 struct snd_kcontrol *headphone_ctrl; 601 565 struct snd_kcontrol *lineout_ctrl; 602 566 struct snd_kcontrol *speaker_ctrl; 567 + struct snd_kcontrol *master_ctrl; 603 568 struct snd_kcontrol *headphone_detected_ctrl; 604 569 struct snd_kcontrol *lineout_detected_ctrl; 605 570 ··· 652 615 AMP_CONTROL(headphone, "Headphone Switch"); 653 616 AMP_CONTROL(speakers, "Speakers Switch"); 654 617 AMP_CONTROL(lineout, "Line-Out Switch"); 618 + AMP_CONTROL(master, "Master Switch"); 655 619 656 620 static int detect_choice_get(struct snd_kcontrol *kcontrol, 657 621 struct snd_ctl_elem_value *ucontrol) ··· 893 855 lineout = codec->gpio->methods->get_detect(codec->gpio, 894 856 AOA_NOTIFY_LINE_OUT); 895 857 858 + if (codec->gpio->methods->set_master) { 859 + ctl = snd_ctl_new1(&master_ctl, codec->gpio); 860 + ldev->master_ctrl = ctl; 861 + aoa_snd_ctl_add(ctl); 862 + } 896 863 while (cc->connected) { 897 864 if (cc->connected & CC_SPEAKERS) { 898 865 if (headphones <= 0 && lineout <= 0) ··· 981 938 static int aoa_fabric_layout_probe(struct soundbus_dev *sdev) 982 939 { 983 940 struct device_node *sound = NULL; 984 - const unsigned int *layout_id; 985 - struct layout *layout; 941 + const unsigned int *id; 942 + struct layout *layout = NULL; 986 943 struct layout_dev *ldev = NULL; 987 944 int err; 988 945 ··· 995 952 if (sound->type && strcasecmp(sound->type, "soundchip") == 0) 996 953 break; 997 954 } 998 - if (!sound) return -ENODEV; 955 + if (!sound) 956 + return -ENODEV; 999 957 1000 - layout_id = of_get_property(sound, "layout-id", NULL); 1001 - if (!layout_id) 1002 - goto outnodev; 1003 - printk(KERN_INFO "snd-aoa-fabric-layout: found bus with layout %d\n", 1004 - *layout_id); 958 + id = of_get_property(sound, "layout-id", NULL); 959 + if (id) { 960 + layout = find_layout_by_id(*id); 961 + } else { 962 + id = of_get_property(sound, "device-id", NULL); 963 + if (id) 964 + layout = find_layout_by_device(*id); 965 + } 1005 966 1006 - layout = find_layout_by_id(*layout_id); 1007 967 if (!layout) { 1008 968 printk(KERN_ERR "snd-aoa-fabric-layout: unknown layout\n"); 1009 969 goto outnodev; ··· 1022 976 ldev->layout = layout; 1023 977 ldev->gpio.node = sound->parent; 1024 978 switch (layout->layout_id) { 979 + case 0: /* anything with device_id, not layout_id */ 1025 980 case 41: /* that unknown machine no one seems to have */ 1026 981 case 51: /* PowerBook5,4 */ 1027 982 case 58: /* Mac Mini */
+17 -5
sound/aoa/soundbus/i2sbus/core.c
··· 1 1 /* 2 2 * i2sbus driver 3 3 * 4 - * Copyright 2006 Johannes Berg <johannes@sipsolutions.net> 4 + * Copyright 2006-2008 Johannes Berg <johannes@sipsolutions.net> 5 5 * 6 6 * GPL v2, can be found in COPYING. 7 7 */ ··· 186 186 } 187 187 } 188 188 if (i == 1) { 189 - const u32 *layout_id = 190 - of_get_property(sound, "layout-id", NULL); 191 - if (layout_id) { 192 - layout = *layout_id; 189 + const u32 *id = of_get_property(sound, "layout-id", NULL); 190 + 191 + if (id) { 192 + layout = *id; 193 193 snprintf(dev->sound.modalias, 32, 194 194 "sound-layout-%d", layout); 195 195 ok = 1; 196 + } else { 197 + id = of_get_property(sound, "device-id", NULL); 198 + /* 199 + * We probably cannot handle all device-id machines, 200 + * so restrict to those we do handle for now. 201 + */ 202 + if (id && (*id == 22 || *id == 14 || *id == 35)) { 203 + snprintf(dev->sound.modalias, 32, 204 + "aoa-device-id-%d", *id); 205 + ok = 1; 206 + layout = -1; 207 + } 196 208 } 197 209 } 198 210 /* for the time being, until we can handle non-layout-id