diff options
Diffstat (limited to 'sound/oss')
-rw-r--r-- | sound/oss/dmasound/dmasound_awacs.c | 121 | ||||
-rw-r--r-- | sound/oss/dmasound/dmasound_core.c | 20 | ||||
-rw-r--r-- | sound/oss/dmasound/tas_common.c | 9 |
3 files changed, 95 insertions, 55 deletions
diff --git a/sound/oss/dmasound/dmasound_awacs.c b/sound/oss/dmasound/dmasound_awacs.c index 37773b1deea5..730fa1d001a5 100644 --- a/sound/oss/dmasound/dmasound_awacs.c +++ b/sound/oss/dmasound/dmasound_awacs.c | |||
@@ -257,7 +257,7 @@ static volatile struct dbdma_cmd *emergency_dbdma_cmd; | |||
257 | /* | 257 | /* |
258 | * Stuff for restoring after a sleep. | 258 | * Stuff for restoring after a sleep. |
259 | */ | 259 | */ |
260 | static int awacs_sleep_notify(struct pmu_sleep_notifier *self, int when); | 260 | static void awacs_sleep_notify(struct pmu_sleep_notifier *self, int when); |
261 | struct pmu_sleep_notifier awacs_sleep_notifier = { | 261 | struct pmu_sleep_notifier awacs_sleep_notifier = { |
262 | awacs_sleep_notify, SLEEP_LEVEL_SOUND, | 262 | awacs_sleep_notify, SLEEP_LEVEL_SOUND, |
263 | }; | 263 | }; |
@@ -346,36 +346,42 @@ int gpio_headphone_irq; | |||
346 | int | 346 | int |
347 | setup_audio_gpio(const char *name, const char* compatible, int *gpio_addr, int* gpio_pol) | 347 | setup_audio_gpio(const char *name, const char* compatible, int *gpio_addr, int* gpio_pol) |
348 | { | 348 | { |
349 | struct device_node *gpiop; | ||
349 | struct device_node *np; | 350 | struct device_node *np; |
350 | const u32* pp; | 351 | const u32* pp; |
352 | int ret = -ENODEV; | ||
351 | 353 | ||
352 | np = find_devices("gpio"); | 354 | gpiop = of_find_node_by_name(NULL, "gpio"); |
353 | if (!np) | 355 | if (!gpiop) |
354 | return -ENODEV; | 356 | goto done; |
355 | 357 | ||
356 | np = np->child; | 358 | np = of_get_next_child(gpiop, NULL); |
357 | while(np != 0) { | 359 | while(np != 0) { |
358 | if (name) { | 360 | if (name) { |
359 | const char *property = | 361 | const char *property = |
360 | get_property(np,"audio-gpio",NULL); | 362 | of_get_property(np,"audio-gpio",NULL); |
361 | if (property != 0 && strcmp(property,name) == 0) | 363 | if (property != 0 && strcmp(property,name) == 0) |
362 | break; | 364 | break; |
363 | } else if (compatible && device_is_compatible(np, compatible)) | 365 | } else if (compatible && device_is_compatible(np, compatible)) |
364 | break; | 366 | break; |
365 | np = np->sibling; | 367 | np = of_get_next_child(gpiop, np); |
366 | } | 368 | } |
367 | if (!np) | 369 | if (!np) |
368 | return -ENODEV; | 370 | goto done; |
369 | pp = get_property(np, "AAPL,address", NULL); | 371 | pp = of_get_property(np, "AAPL,address", NULL); |
370 | if (!pp) | 372 | if (!pp) |
371 | return -ENODEV; | 373 | goto done; |
372 | *gpio_addr = (*pp) & 0x0000ffff; | 374 | *gpio_addr = (*pp) & 0x0000ffff; |
373 | pp = get_property(np, "audio-gpio-active-state", NULL); | 375 | pp = of_get_property(np, "audio-gpio-active-state", NULL); |
374 | if (pp) | 376 | if (pp) |
375 | *gpio_pol = *pp; | 377 | *gpio_pol = *pp; |
376 | else | 378 | else |
377 | *gpio_pol = 1; | 379 | *gpio_pol = 1; |
378 | return irq_of_parse_and_map(np, 0); | 380 | ret = irq_of_parse_and_map(np, 0); |
381 | done: | ||
382 | of_node_put(np); | ||
383 | of_node_put(gpiop); | ||
384 | return ret; | ||
379 | } | 385 | } |
380 | 386 | ||
381 | static inline void | 387 | static inline void |
@@ -578,7 +584,7 @@ tas_mixer_ioctl(u_int cmd, u_long arg) | |||
578 | } | 584 | } |
579 | 585 | ||
580 | static void __init | 586 | static void __init |
581 | tas_init_frame_rates(unsigned int *prop, unsigned int l) | 587 | tas_init_frame_rates(const unsigned int *prop, unsigned int l) |
582 | { | 588 | { |
583 | int i ; | 589 | int i ; |
584 | if (prop) { | 590 | if (prop) { |
@@ -1419,7 +1425,7 @@ load_awacs(void) | |||
1419 | * Save state when going to sleep, restore it afterwards. | 1425 | * Save state when going to sleep, restore it afterwards. |
1420 | */ | 1426 | */ |
1421 | /* FIXME: sort out disabling/re-enabling of read stuff as well */ | 1427 | /* FIXME: sort out disabling/re-enabling of read stuff as well */ |
1422 | static int awacs_sleep_notify(struct pmu_sleep_notifier *self, int when) | 1428 | static void awacs_sleep_notify(struct pmu_sleep_notifier *self, int when) |
1423 | { | 1429 | { |
1424 | unsigned long flags; | 1430 | unsigned long flags; |
1425 | 1431 | ||
@@ -1548,7 +1554,6 @@ static int awacs_sleep_notify(struct pmu_sleep_notifier *self, int when) | |||
1548 | spin_unlock_irqrestore(&dmasound.lock, flags); | 1554 | spin_unlock_irqrestore(&dmasound.lock, flags); |
1549 | UNLOCK(); | 1555 | UNLOCK(); |
1550 | } | 1556 | } |
1551 | return PBOOK_SLEEP_OK; | ||
1552 | } | 1557 | } |
1553 | #endif /* CONFIG_PM */ | 1558 | #endif /* CONFIG_PM */ |
1554 | 1559 | ||
@@ -2553,32 +2558,33 @@ set_model(void) | |||
2553 | static struct device_node* __init | 2558 | static struct device_node* __init |
2554 | get_snd_io_node(void) | 2559 | get_snd_io_node(void) |
2555 | { | 2560 | { |
2556 | struct device_node *np = NULL; | 2561 | struct device_node *np; |
2557 | 2562 | ||
2558 | /* set up awacs_node for early OF which doesn't have a full set of | 2563 | /* set up awacs_node for early OF which doesn't have a full set of |
2559 | * properties on davbus | 2564 | * properties on davbus |
2560 | */ | 2565 | */ |
2561 | 2566 | awacs_node = of_find_node_by_name(NULL, "awacs"); | |
2562 | awacs_node = find_devices("awacs"); | ||
2563 | if (awacs_node) | 2567 | if (awacs_node) |
2564 | awacs_revision = AWACS_AWACS; | 2568 | awacs_revision = AWACS_AWACS; |
2565 | 2569 | ||
2566 | /* powermac models after 9500 (other than those which use DACA or | 2570 | /* powermac models after 9500 (other than those which use DACA or |
2567 | * Tumbler) have a node called "davbus". | 2571 | * Tumbler) have a node called "davbus". |
2568 | */ | 2572 | */ |
2569 | np = find_devices("davbus"); | 2573 | np = of_find_node_by_name(NULL, "davbus"); |
2570 | /* | 2574 | /* |
2571 | * if we didn't find a davbus device, try 'i2s-a' since | 2575 | * if we didn't find a davbus device, try 'i2s-a' since |
2572 | * this seems to be what iBooks (& Tumbler) have. | 2576 | * this seems to be what iBooks (& Tumbler) have. |
2573 | */ | 2577 | */ |
2574 | if (np == NULL) | 2578 | if (np == NULL) { |
2575 | np = i2s_node = find_devices("i2s-a"); | 2579 | i2s_node = of_find_node_by_name(NULL, "i2s-a"); |
2580 | np = of_node_get(i2s_node); | ||
2581 | } | ||
2576 | 2582 | ||
2577 | /* if we didn't find this - perhaps we are on an early model | 2583 | /* if we didn't find this - perhaps we are on an early model |
2578 | * which _only_ has an 'awacs' node | 2584 | * which _only_ has an 'awacs' node |
2579 | */ | 2585 | */ |
2580 | if (np == NULL && awacs_node) | 2586 | if (np == NULL && awacs_node) |
2581 | np = awacs_node ; | 2587 | np = of_node_get(awacs_node); |
2582 | 2588 | ||
2583 | /* if we failed all these return null - this will cause the | 2589 | /* if we failed all these return null - this will cause the |
2584 | * driver to give up... | 2590 | * driver to give up... |
@@ -2597,9 +2603,9 @@ get_snd_info_node(struct device_node *io) | |||
2597 | { | 2603 | { |
2598 | struct device_node *info; | 2604 | struct device_node *info; |
2599 | 2605 | ||
2600 | info = find_devices("sound"); | 2606 | for_each_node_by_name(info, "sound") |
2601 | while (info && info->parent != io) | 2607 | if (info->parent == io) |
2602 | info = info->next; | 2608 | break; |
2603 | return info; | 2609 | return info; |
2604 | } | 2610 | } |
2605 | 2611 | ||
@@ -2635,11 +2641,17 @@ get_codec_type(struct device_node *info) | |||
2635 | static void __init | 2641 | static void __init |
2636 | get_expansion_type(void) | 2642 | get_expansion_type(void) |
2637 | { | 2643 | { |
2638 | if (find_devices("perch") != NULL) | 2644 | struct device_node *dn; |
2645 | |||
2646 | dn = of_find_node_by_name(NULL, "perch"); | ||
2647 | if (dn != NULL) | ||
2639 | has_perch = 1; | 2648 | has_perch = 1; |
2649 | of_node_put(dn); | ||
2640 | 2650 | ||
2641 | if (find_devices("pb-ziva-pc") != NULL) | 2651 | dn = of_find_node_by_name(NULL, "pb-ziva-pc"); |
2652 | if (dn != NULL) | ||
2642 | has_ziva = 1; | 2653 | has_ziva = 1; |
2654 | of_node_put(dn); | ||
2643 | /* need to work out how we deal with iMac SRS module */ | 2655 | /* need to work out how we deal with iMac SRS module */ |
2644 | } | 2656 | } |
2645 | 2657 | ||
@@ -2652,7 +2664,7 @@ get_expansion_type(void) | |||
2652 | */ | 2664 | */ |
2653 | 2665 | ||
2654 | static void __init | 2666 | static void __init |
2655 | awacs_init_frame_rates(unsigned int *prop, unsigned int l) | 2667 | awacs_init_frame_rates(const unsigned int *prop, unsigned int l) |
2656 | { | 2668 | { |
2657 | int i ; | 2669 | int i ; |
2658 | if (prop) { | 2670 | if (prop) { |
@@ -2675,7 +2687,7 @@ awacs_init_frame_rates(unsigned int *prop, unsigned int l) | |||
2675 | } | 2687 | } |
2676 | 2688 | ||
2677 | static void __init | 2689 | static void __init |
2678 | burgundy_init_frame_rates(unsigned int *prop, unsigned int l) | 2690 | burgundy_init_frame_rates(const unsigned int *prop, unsigned int l) |
2679 | { | 2691 | { |
2680 | int temp[9] ; | 2692 | int temp[9] ; |
2681 | int i = 0 ; | 2693 | int i = 0 ; |
@@ -2701,7 +2713,7 @@ if (i > 1){ | |||
2701 | } | 2713 | } |
2702 | 2714 | ||
2703 | static void __init | 2715 | static void __init |
2704 | daca_init_frame_rates(unsigned int *prop, unsigned int l) | 2716 | daca_init_frame_rates(const unsigned int *prop, unsigned int l) |
2705 | { | 2717 | { |
2706 | int temp[9] ; | 2718 | int temp[9] ; |
2707 | int i = 0 ; | 2719 | int i = 0 ; |
@@ -2728,7 +2740,7 @@ if (i > 1){ | |||
2728 | } | 2740 | } |
2729 | 2741 | ||
2730 | static void __init | 2742 | static void __init |
2731 | init_frame_rates(unsigned int *prop, unsigned int l) | 2743 | init_frame_rates(const unsigned int *prop, unsigned int l) |
2732 | { | 2744 | { |
2733 | switch (awacs_revision) { | 2745 | switch (awacs_revision) { |
2734 | case AWACS_TUMBLER: | 2746 | case AWACS_TUMBLER: |
@@ -2828,7 +2840,7 @@ int __init dmasound_awacs_init(void) | |||
2828 | #ifdef DEBUG_DMASOUND | 2840 | #ifdef DEBUG_DMASOUND |
2829 | printk("dmasound_pmac: couldn't find sound io OF node\n"); | 2841 | printk("dmasound_pmac: couldn't find sound io OF node\n"); |
2830 | #endif | 2842 | #endif |
2831 | return -ENODEV ; | 2843 | goto no_device; |
2832 | } | 2844 | } |
2833 | 2845 | ||
2834 | /* find the OF node that tells us about the sound sub-system | 2846 | /* find the OF node that tells us about the sound sub-system |
@@ -2840,7 +2852,7 @@ printk("dmasound_pmac: couldn't find sound io OF node\n"); | |||
2840 | #ifdef DEBUG_DMASOUND | 2852 | #ifdef DEBUG_DMASOUND |
2841 | printk("dmasound_pmac: couldn't find 'sound' OF node\n"); | 2853 | printk("dmasound_pmac: couldn't find 'sound' OF node\n"); |
2842 | #endif | 2854 | #endif |
2843 | return -ENODEV ; | 2855 | goto no_device; |
2844 | } | 2856 | } |
2845 | } | 2857 | } |
2846 | 2858 | ||
@@ -2849,7 +2861,7 @@ printk("dmasound_pmac: couldn't find 'sound' OF node\n"); | |||
2849 | #ifdef DEBUG_DMASOUND | 2861 | #ifdef DEBUG_DMASOUND |
2850 | printk("dmasound_pmac: couldn't find a Codec we can handle\n"); | 2862 | printk("dmasound_pmac: couldn't find a Codec we can handle\n"); |
2851 | #endif | 2863 | #endif |
2852 | return -ENODEV ; /* we don't know this type of h/w */ | 2864 | goto no_device; /* we don't know this type of h/w */ |
2853 | } | 2865 | } |
2854 | 2866 | ||
2855 | /* set up perch, ziva, SRS or whatever else we have as sound | 2867 | /* set up perch, ziva, SRS or whatever else we have as sound |
@@ -2867,11 +2879,12 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n"); | |||
2867 | * machines). | 2879 | * machines). |
2868 | */ | 2880 | */ |
2869 | if (awacs_node) { | 2881 | if (awacs_node) { |
2870 | io = awacs_node ; | 2882 | of_node_put(io); |
2883 | io = of_node_get(awacs_node); | ||
2871 | if (of_get_address(io, 2, NULL, NULL) == NULL) { | 2884 | if (of_get_address(io, 2, NULL, NULL) == NULL) { |
2872 | printk("dmasound_pmac: can't use %s\n", | 2885 | printk("dmasound_pmac: can't use %s\n", |
2873 | io->full_name); | 2886 | io->full_name); |
2874 | return -ENODEV; | 2887 | goto no_device; |
2875 | } | 2888 | } |
2876 | } else | 2889 | } else |
2877 | printk("dmasound_pmac: can't use %s\n", io->full_name); | 2890 | printk("dmasound_pmac: can't use %s\n", io->full_name); |
@@ -2882,7 +2895,7 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n"); | |||
2882 | awacs_rsrc[0].end - awacs_rsrc[0].start + 1, | 2895 | awacs_rsrc[0].end - awacs_rsrc[0].start + 1, |
2883 | " (IO)") == NULL) { | 2896 | " (IO)") == NULL) { |
2884 | printk(KERN_ERR "dmasound: can't request IO resource !\n"); | 2897 | printk(KERN_ERR "dmasound: can't request IO resource !\n"); |
2885 | return -ENODEV; | 2898 | goto no_device; |
2886 | } | 2899 | } |
2887 | if (of_address_to_resource(io, 1, &awacs_rsrc[1]) || | 2900 | if (of_address_to_resource(io, 1, &awacs_rsrc[1]) || |
2888 | request_mem_region(awacs_rsrc[1].start, | 2901 | request_mem_region(awacs_rsrc[1].start, |
@@ -2891,7 +2904,7 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n"); | |||
2891 | release_mem_region(awacs_rsrc[0].start, | 2904 | release_mem_region(awacs_rsrc[0].start, |
2892 | awacs_rsrc[0].end - awacs_rsrc[0].start + 1); | 2905 | awacs_rsrc[0].end - awacs_rsrc[0].start + 1); |
2893 | printk(KERN_ERR "dmasound: can't request Tx DMA resource !\n"); | 2906 | printk(KERN_ERR "dmasound: can't request Tx DMA resource !\n"); |
2894 | return -ENODEV; | 2907 | goto no_device; |
2895 | } | 2908 | } |
2896 | if (of_address_to_resource(io, 2, &awacs_rsrc[2]) || | 2909 | if (of_address_to_resource(io, 2, &awacs_rsrc[2]) || |
2897 | request_mem_region(awacs_rsrc[2].start, | 2910 | request_mem_region(awacs_rsrc[2].start, |
@@ -2902,7 +2915,7 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n"); | |||
2902 | release_mem_region(awacs_rsrc[1].start, | 2915 | release_mem_region(awacs_rsrc[1].start, |
2903 | awacs_rsrc[1].end - awacs_rsrc[1].start + 1); | 2916 | awacs_rsrc[1].end - awacs_rsrc[1].start + 1); |
2904 | printk(KERN_ERR "dmasound: can't request Rx DMA resource !\n"); | 2917 | printk(KERN_ERR "dmasound: can't request Rx DMA resource !\n"); |
2905 | return -ENODEV; | 2918 | goto no_device; |
2906 | } | 2919 | } |
2907 | 2920 | ||
2908 | awacs_beep_dev = input_allocate_device(); | 2921 | awacs_beep_dev = input_allocate_device(); |
@@ -2914,7 +2927,7 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n"); | |||
2914 | release_mem_region(awacs_rsrc[2].start, | 2927 | release_mem_region(awacs_rsrc[2].start, |
2915 | awacs_rsrc[2].end - awacs_rsrc[2].start + 1); | 2928 | awacs_rsrc[2].end - awacs_rsrc[2].start + 1); |
2916 | printk(KERN_ERR "dmasound: can't allocate input device !\n"); | 2929 | printk(KERN_ERR "dmasound: can't allocate input device !\n"); |
2917 | return -ENOMEM; | 2930 | goto no_device; |
2918 | } | 2931 | } |
2919 | 2932 | ||
2920 | awacs_beep_dev->name = "dmasound beeper"; | 2933 | awacs_beep_dev->name = "dmasound beeper"; |
@@ -2942,7 +2955,8 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n"); | |||
2942 | awacs_rx_irq = irq_of_parse_and_map(io, 2); | 2955 | awacs_rx_irq = irq_of_parse_and_map(io, 2); |
2943 | 2956 | ||
2944 | /* Hack for legacy crap that will be killed someday */ | 2957 | /* Hack for legacy crap that will be killed someday */ |
2945 | awacs_node = io; | 2958 | of_node_put(awacs_node); |
2959 | awacs_node = of_node_get(io); | ||
2946 | 2960 | ||
2947 | /* if we have an awacs or screamer - probe the chip to make | 2961 | /* if we have an awacs or screamer - probe the chip to make |
2948 | * sure we have the right revision. | 2962 | * sure we have the right revision. |
@@ -2973,24 +2987,26 @@ printk("dmasound_pmac: Awacs/Screamer Codec Mfct: %d Rev %d\n", mfg, rev); | |||
2973 | */ | 2987 | */ |
2974 | 2988 | ||
2975 | if (info) { | 2989 | if (info) { |
2976 | unsigned int *prop, l; | 2990 | const unsigned int *prop; |
2991 | unsigned int l; | ||
2977 | 2992 | ||
2978 | sound_device_id = 0; | 2993 | sound_device_id = 0; |
2979 | /* device ID appears post g3 b&w */ | 2994 | /* device ID appears post g3 b&w */ |
2980 | prop = (unsigned int *)get_property(info, "device-id", NULL); | 2995 | prop = of_get_property(info, "device-id", NULL); |
2981 | if (prop != 0) | 2996 | if (prop != 0) |
2982 | sound_device_id = *prop; | 2997 | sound_device_id = *prop; |
2983 | 2998 | ||
2984 | /* look for a property saying what sample rates | 2999 | /* look for a property saying what sample rates |
2985 | are available */ | 3000 | are available */ |
2986 | 3001 | ||
2987 | prop = (unsigned int *)get_property(info, "sample-rates", &l); | 3002 | prop = of_get_property(info, "sample-rates", &l); |
2988 | if (prop == 0) | 3003 | if (prop == 0) |
2989 | prop = (unsigned int *) get_property | 3004 | prop = of_get_property(info, "output-frame-rates", &l); |
2990 | (info, "output-frame-rates", &l); | ||
2991 | 3005 | ||
2992 | /* if it's there use it to set up frame rates */ | 3006 | /* if it's there use it to set up frame rates */ |
2993 | init_frame_rates(prop, l) ; | 3007 | init_frame_rates(prop, l) ; |
3008 | of_node_put(info); | ||
3009 | info = NULL; | ||
2994 | } | 3010 | } |
2995 | 3011 | ||
2996 | if (awacs) | 3012 | if (awacs) |
@@ -3160,7 +3176,16 @@ printk("dmasound_pmac: Awacs/Screamer Codec Mfct: %d Rev %d\n", mfg, rev); | |||
3160 | */ | 3176 | */ |
3161 | input_register_device(awacs_beep_dev); | 3177 | input_register_device(awacs_beep_dev); |
3162 | 3178 | ||
3179 | of_node_put(io); | ||
3180 | |||
3163 | return dmasound_init(); | 3181 | return dmasound_init(); |
3182 | |||
3183 | no_device: | ||
3184 | of_node_put(info); | ||
3185 | of_node_put(awacs_node); | ||
3186 | of_node_put(i2s_node); | ||
3187 | of_node_put(io); | ||
3188 | return -ENODEV ; | ||
3164 | } | 3189 | } |
3165 | 3190 | ||
3166 | static void __exit dmasound_awacs_cleanup(void) | 3191 | static void __exit dmasound_awacs_cleanup(void) |
@@ -3179,6 +3204,8 @@ static void __exit dmasound_awacs_cleanup(void) | |||
3179 | } | 3204 | } |
3180 | dmasound_deinit(); | 3205 | dmasound_deinit(); |
3181 | 3206 | ||
3207 | of_node_put(awacs_node); | ||
3208 | of_node_put(i2s_node); | ||
3182 | } | 3209 | } |
3183 | 3210 | ||
3184 | MODULE_DESCRIPTION("PowerMac built-in audio driver."); | 3211 | MODULE_DESCRIPTION("PowerMac built-in audio driver."); |
diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c index a0ec886f2aa3..f4056a9c371b 100644 --- a/sound/oss/dmasound/dmasound_core.c +++ b/sound/oss/dmasound/dmasound_core.c | |||
@@ -1346,22 +1346,34 @@ static const struct file_operations sq_fops = | |||
1346 | .ioctl = sq_ioctl, | 1346 | .ioctl = sq_ioctl, |
1347 | .open = sq_open, | 1347 | .open = sq_open, |
1348 | .release = sq_release, | 1348 | .release = sq_release, |
1349 | }; | ||
1350 | |||
1349 | #ifdef HAS_RECORD | 1351 | #ifdef HAS_RECORD |
1350 | .read = NULL /* default to no read for compat mode */ | 1352 | static const struct file_operations sq_fops_record = |
1351 | #endif | 1353 | { |
1354 | .owner = THIS_MODULE, | ||
1355 | .llseek = no_llseek, | ||
1356 | .write = sq_write, | ||
1357 | .poll = sq_poll, | ||
1358 | .ioctl = sq_ioctl, | ||
1359 | .open = sq_open, | ||
1360 | .release = sq_release, | ||
1361 | .read = sq_read, | ||
1352 | }; | 1362 | }; |
1363 | #endif | ||
1353 | 1364 | ||
1354 | static int sq_init(void) | 1365 | static int sq_init(void) |
1355 | { | 1366 | { |
1367 | const struct file_operations *fops = &sq_fops; | ||
1356 | #ifndef MODULE | 1368 | #ifndef MODULE |
1357 | int sq_unit; | 1369 | int sq_unit; |
1358 | #endif | 1370 | #endif |
1359 | 1371 | ||
1360 | #ifdef HAS_RECORD | 1372 | #ifdef HAS_RECORD |
1361 | if (dmasound.mach.record) | 1373 | if (dmasound.mach.record) |
1362 | sq_fops.read = sq_read ; | 1374 | fops = &sq_fops_record; |
1363 | #endif | 1375 | #endif |
1364 | sq_unit = register_sound_dsp(&sq_fops, -1); | 1376 | sq_unit = register_sound_dsp(fops, -1); |
1365 | if (sq_unit < 0) { | 1377 | if (sq_unit < 0) { |
1366 | printk(KERN_ERR "dmasound_core: couldn't register fops\n") ; | 1378 | printk(KERN_ERR "dmasound_core: couldn't register fops\n") ; |
1367 | return sq_unit ; | 1379 | return sq_unit ; |
diff --git a/sound/oss/dmasound/tas_common.c b/sound/oss/dmasound/tas_common.c index 665e85b5562b..b295ef682192 100644 --- a/sound/oss/dmasound/tas_common.c +++ b/sound/oss/dmasound/tas_common.c | |||
@@ -41,7 +41,6 @@ | |||
41 | 41 | ||
42 | static u8 tas_i2c_address = 0x34; | 42 | static u8 tas_i2c_address = 0x34; |
43 | static struct i2c_client *tas_client; | 43 | static struct i2c_client *tas_client; |
44 | static struct device_node* tas_node; | ||
45 | 44 | ||
46 | static int tas_attach_adapter(struct i2c_adapter *); | 45 | static int tas_attach_adapter(struct i2c_adapter *); |
47 | static int tas_detach_client(struct i2c_client *); | 46 | static int tas_detach_client(struct i2c_client *); |
@@ -190,17 +189,18 @@ tas_cleanup(void) | |||
190 | int __init | 189 | int __init |
191 | tas_init(int driver_id, const char *driver_name) | 190 | tas_init(int driver_id, const char *driver_name) |
192 | { | 191 | { |
193 | u32* paddr; | 192 | const u32* paddr; |
193 | struct device_node *tas_node; | ||
194 | 194 | ||
195 | printk(KERN_INFO "tas driver [%s])\n", driver_name); | 195 | printk(KERN_INFO "tas driver [%s])\n", driver_name); |
196 | 196 | ||
197 | #ifndef CONFIG_I2C_POWERMAC | 197 | #ifndef CONFIG_I2C_POWERMAC |
198 | request_module("i2c-powermac"); | 198 | request_module("i2c-powermac"); |
199 | #endif | 199 | #endif |
200 | tas_node = find_devices("deq"); | 200 | tas_node = of_find_node_by_name("deq"); |
201 | if (tas_node == NULL) | 201 | if (tas_node == NULL) |
202 | return -ENODEV; | 202 | return -ENODEV; |
203 | paddr = (u32 *)get_property(tas_node, "i2c-address", NULL); | 203 | paddr = of_get_property(tas_node, "i2c-address", NULL); |
204 | if (paddr) { | 204 | if (paddr) { |
205 | tas_i2c_address = (*paddr) >> 1; | 205 | tas_i2c_address = (*paddr) >> 1; |
206 | printk(KERN_INFO "using i2c address: 0x%x from device-tree\n", | 206 | printk(KERN_INFO "using i2c address: 0x%x from device-tree\n", |
@@ -208,6 +208,7 @@ tas_init(int driver_id, const char *driver_name) | |||
208 | } else | 208 | } else |
209 | printk(KERN_INFO "using i2c address: 0x%x (default)\n", | 209 | printk(KERN_INFO "using i2c address: 0x%x (default)\n", |
210 | tas_i2c_address); | 210 | tas_i2c_address); |
211 | of_node_put(tas_node); | ||
211 | 212 | ||
212 | return i2c_add_driver(&tas_driver); | 213 | return i2c_add_driver(&tas_driver); |
213 | } | 214 | } |