]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 4 Jun 2010 22:27:27 +0000 (15:27 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 4 Jun 2010 22:27:27 +0000 (15:27 -0700)
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6:
  fix setattr error handling in sysfs, configfs
  kobject: free memory if netlink_kernel_create() fails
  lib/kobject_uevent.c: fix CONIG_NET=n warning

68 files changed:
Documentation/feature-removal-schedule.txt
arch/frv/mm/fault.c
arch/m32r/mm/fault.c
arch/mn10300/mm/fault.c
arch/um/kernel/skas/uaccess.c
arch/xtensa/mm/fault.c
drivers/acpi/ec.c
drivers/acpi/internal.h
drivers/acpi/processor_idle.c
drivers/acpi/sleep.c
drivers/char/Kconfig
drivers/char/n_gsm.c
drivers/char/vt.c
drivers/char/vt_ioctl.c
drivers/misc/vmware_balloon.c
drivers/mmc/host/omap.c
drivers/rtc/rtc-s3c.c
drivers/serial/8250_pci.c
drivers/serial/altera_uart.c
drivers/serial/bfin_5xx.c
drivers/serial/msm_serial.c
drivers/serial/msm_serial.h
drivers/serial/serial_cs.c
drivers/sfi/sfi_core.c
drivers/usb/class/cdc-acm.c
drivers/usb/core/driver.c
drivers/usb/gadget/Kconfig
drivers/usb/gadget/f_audio.c
drivers/usb/gadget/s3c-hsotg.c
drivers/usb/host/ehci-hcd.c
drivers/usb/host/isp1362.h
drivers/usb/host/xhci-pci.c
drivers/usb/host/xhci-ring.c
drivers/usb/host/xhci.c
drivers/usb/host/xhci.h
drivers/usb/serial/digi_acceleport.c
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/mos7840.c
drivers/video/Kconfig
drivers/video/fb_defio.c
fs/binfmt_flat.c
fs/compat.c
include/linux/personality.h
include/linux/syscalls.h
include/linux/usb/audio-v2.h
include/linux/usb/audio.h
kernel/cgroup.c
kernel/exec_domain.c
kernel/softirq.c
kernel/timer.c
lib/atomic64_test.c
mm/vmscan.c
sound/pci/asihpi/asihpi.c
sound/pci/hda/hda_intel.c
sound/pci/hda/patch_realtek.c
sound/soc/imx/Kconfig
sound/usb/Makefile
sound/usb/card.c
sound/usb/card.h
sound/usb/clock.c [new file with mode: 0644]
sound/usb/clock.h [new file with mode: 0644]
sound/usb/endpoint.c
sound/usb/format.c
sound/usb/mixer.c
sound/usb/mixer.h
sound/usb/mixer_maps.c
sound/usb/pcm.c
sound/usb/usbaudio.h

index 672be0109d02617dfa03536c9a4fae7ad4ae4831..c268783bc4e7c18c2e4db792c3fba83d6bc44c71 100644 (file)
@@ -578,15 +578,6 @@ Who:       Avi Kivity <avi@redhat.com>
 
 ----------------------------
 
-What:  "acpi=ht" boot option
-When:  2.6.35
-Why:   Useful in 2003, implementation is a hack.
-       Generally invoked by accident today.
-       Seen as doing more harm than good.
-Who:   Len Brown <len.brown@intel.com>
-
-----------------------------
-
 What:  iwlwifi 50XX module parameters
 When:  2.6.40
 Why:   The "..50" modules parameters were used to configure 5000 series and
index 30f5d100a81c15038f79f88672db560cf4f950a5..a325d57a83d5fdae12d8323480564d8204e86117 100644 (file)
@@ -257,10 +257,10 @@ asmlinkage void do_page_fault(int datammu, unsigned long esr0, unsigned long ear
  */
  out_of_memory:
        up_read(&mm->mmap_sem);
-       printk("VM: killing process %s\n", current->comm);
-       if (user_mode(__frame))
-               do_group_exit(SIGKILL);
-       goto no_context;
+       if (!user_mode(__frame))
+               goto no_context;
+       pagefault_out_of_memory();
+       return;
 
  do_sigbus:
        up_read(&mm->mmap_sem);
index 28ee389e5f5a3e43d39f8d5f1cdccf45923785d3..b8ec002aef8e321349f17b9255b70762b4b029ce 100644 (file)
@@ -188,7 +188,6 @@ good_area:
        if ((error_code & ACE_INSTRUCTION) && !(vma->vm_flags & VM_EXEC))
          goto bad_area;
 
-survive:
        /*
         * If for any reason at all we couldn't handle the fault,
         * make sure we exit gracefully rather than endlessly redo
@@ -271,15 +270,10 @@ no_context:
  */
 out_of_memory:
        up_read(&mm->mmap_sem);
-       if (is_global_init(tsk)) {
-               yield();
-               down_read(&mm->mmap_sem);
-               goto survive;
-       }
-       printk("VM: killing process %s\n", tsk->comm);
-       if (error_code & ACE_USERMODE)
-               do_group_exit(SIGKILL);
-       goto no_context;
+       if (!(error_code & ACE_USERMODE))
+               goto no_context;
+       pagefault_out_of_memory();
+       return;
 
 do_sigbus:
        up_read(&mm->mmap_sem);
index 53bb17d0f0687764ab1d8a4e05d6cdfc81c03e25..81f153fa51b4a6ecb07111f1d20383fbf0b6eaf2 100644 (file)
@@ -338,11 +338,10 @@ no_context:
  */
 out_of_memory:
        up_read(&mm->mmap_sem);
-       monitor_signal(regs);
-       printk(KERN_ALERT "VM: killing process %s\n", tsk->comm);
-       if ((fault_code & MMUFCR_xFC_ACCESS) == MMUFCR_xFC_ACCESS_USR)
-               do_exit(SIGKILL);
-       goto no_context;
+       if ((fault_code & MMUFCR_xFC_ACCESS) != MMUFCR_xFC_ACCESS_USR)
+               goto no_context;
+       pagefault_out_of_memory();
+       return;
 
 do_sigbus:
        up_read(&mm->mmap_sem);
index e22c96993db3b07545e107adb57f2ef1d8ddb608..696634214dc65551557ab88535b40557fed4eb7c 100644 (file)
@@ -81,7 +81,7 @@ static int do_op_one_page(unsigned long addr, int len, int is_write,
 
        current->thread.fault_catcher = NULL;
 
-       kunmap_atomic(page, KM_UML_USERCOPY);
+       kunmap_atomic((void *)addr, KM_UML_USERCOPY);
 
        return n;
 }
index bc0733359a8852a12288f083c2420f4c9734948e..e367e30264366d82c17dc66d157a2aa2534388bc 100644 (file)
@@ -105,7 +105,6 @@ good_area:
         * make sure we exit gracefully rather than endlessly redo
         * the fault.
         */
-survive:
        fault = handle_mm_fault(mm, vma, address, is_write ? FAULT_FLAG_WRITE : 0);
        if (unlikely(fault & VM_FAULT_ERROR)) {
                if (fault & VM_FAULT_OOM)
@@ -146,15 +145,10 @@ bad_area:
         */
 out_of_memory:
        up_read(&mm->mmap_sem);
-       if (is_global_init(current)) {
-               yield();
-               down_read(&mm->mmap_sem);
-               goto survive;
-       }
-       printk("VM: killing process %s\n", current->comm);
-       if (user_mode(regs))
-               do_group_exit(SIGKILL);
-       bad_page_fault(regs, address, SIGKILL);
+       if (!user_mode(regs))
+               bad_page_fault(regs, address, SIGKILL);
+       else
+               pagefault_out_of_memory();
        return;
 
 do_sigbus:
index e61d4f8e62a54a42dd8f39b5c9647b2a08449e07..5f2027d782e8134642d777225f4c37f6120b214f 100644 (file)
@@ -79,7 +79,7 @@ enum {
        EC_FLAGS_GPE_STORM,             /* GPE storm detected */
        EC_FLAGS_HANDLERS_INSTALLED,    /* Handlers for GPE and
                                         * OpReg are installed */
-       EC_FLAGS_FROZEN,                /* Transactions are suspended */
+       EC_FLAGS_BLOCKED,               /* Transactions are blocked */
 };
 
 /* If we find an EC via the ECDT, we need to keep a ptr to its context */
@@ -293,7 +293,7 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
        if (t->rdata)
                memset(t->rdata, 0, t->rlen);
        mutex_lock(&ec->lock);
-       if (test_bit(EC_FLAGS_FROZEN, &ec->flags)) {
+       if (test_bit(EC_FLAGS_BLOCKED, &ec->flags)) {
                status = -EINVAL;
                goto unlock;
        }
@@ -459,7 +459,7 @@ int ec_transaction(u8 command,
 
 EXPORT_SYMBOL(ec_transaction);
 
-void acpi_ec_suspend_transactions(void)
+void acpi_ec_block_transactions(void)
 {
        struct acpi_ec *ec = first_ec;
 
@@ -468,11 +468,11 @@ void acpi_ec_suspend_transactions(void)
 
        mutex_lock(&ec->lock);
        /* Prevent transactions from being carried out */
-       set_bit(EC_FLAGS_FROZEN, &ec->flags);
+       set_bit(EC_FLAGS_BLOCKED, &ec->flags);
        mutex_unlock(&ec->lock);
 }
 
-void acpi_ec_resume_transactions(void)
+void acpi_ec_unblock_transactions(void)
 {
        struct acpi_ec *ec = first_ec;
 
@@ -481,10 +481,20 @@ void acpi_ec_resume_transactions(void)
 
        mutex_lock(&ec->lock);
        /* Allow transactions to be carried out again */
-       clear_bit(EC_FLAGS_FROZEN, &ec->flags);
+       clear_bit(EC_FLAGS_BLOCKED, &ec->flags);
        mutex_unlock(&ec->lock);
 }
 
+void acpi_ec_unblock_transactions_early(void)
+{
+       /*
+        * Allow transactions to happen again (this function is called from
+        * atomic context during wakeup, so we don't need to acquire the mutex).
+        */
+       if (first_ec)
+               clear_bit(EC_FLAGS_BLOCKED, &first_ec->flags);
+}
+
 static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 * data)
 {
        int result;
index e28411367239a117f48f2773f489aa41919bcf1f..f8f190ec066e7a266101b0783a97e8f274f5a639 100644 (file)
@@ -49,8 +49,9 @@ void acpi_early_processor_set_pdc(void);
 int acpi_ec_init(void);
 int acpi_ec_ecdt_probe(void);
 int acpi_boot_ec_enable(void);
-void acpi_ec_suspend_transactions(void);
-void acpi_ec_resume_transactions(void);
+void acpi_ec_block_transactions(void);
+void acpi_ec_unblock_transactions(void);
+void acpi_ec_unblock_transactions_early(void);
 
 /*--------------------------------------------------------------------------
                                   Suspend/Resume
index 2e8c27d48f2b75f59f0e76436ae94db5f61466a7..b1b385692f46e09f05dd55882ed3ea9c73039b74 100644 (file)
@@ -80,7 +80,7 @@ module_param(nocst, uint, 0000);
 static unsigned int latency_factor __read_mostly = 2;
 module_param(latency_factor, uint, 0644);
 
-static s64 us_to_pm_timer_ticks(s64 t)
+static u64 us_to_pm_timer_ticks(s64 t)
 {
        return div64_u64(t * PM_TIMER_FREQUENCY, 1000000);
 }
@@ -731,10 +731,10 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset)
 
                seq_puts(seq, "demotion[--] ");
 
-               seq_printf(seq, "latency[%03d] usage[%08d] duration[%020llu]\n",
+               seq_printf(seq, "latency[%03d] usage[%08d] duration[%020Lu]\n",
                           pr->power.states[i].latency,
                           pr->power.states[i].usage,
-                          (unsigned long long)pr->power.states[i].time);
+                          us_to_pm_timer_ticks(pr->power.states[i].time));
        }
 
       end:
@@ -861,7 +861,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
        ktime_t  kt1, kt2;
        s64 idle_time_ns;
        s64 idle_time;
-       s64 sleep_ticks = 0;
 
        pr = __get_cpu_var(processors);
 
@@ -906,8 +905,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
        idle_time = idle_time_ns;
        do_div(idle_time, NSEC_PER_USEC);
 
-       sleep_ticks = us_to_pm_timer_ticks(idle_time);
-
        /* Tell the scheduler how much we idled: */
        sched_clock_idle_wakeup_event(idle_time_ns);
 
@@ -918,7 +915,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
        cx->usage++;
 
        lapic_timer_state_broadcast(pr, cx, 0);
-       cx->time += sleep_ticks;
+       cx->time += idle_time;
        return idle_time;
 }
 
@@ -940,7 +937,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
        ktime_t  kt1, kt2;
        s64 idle_time_ns;
        s64 idle_time;
-       s64 sleep_ticks = 0;
 
 
        pr = __get_cpu_var(processors);
@@ -1022,11 +1018,10 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
                spin_unlock(&c3_lock);
        }
        kt2 = ktime_get_real();
-       idle_time_ns = ktime_to_us(ktime_sub(kt2, kt1));
+       idle_time_ns = ktime_to_ns(ktime_sub(kt2, kt1));
        idle_time = idle_time_ns;
        do_div(idle_time, NSEC_PER_USEC);
 
-       sleep_ticks = us_to_pm_timer_ticks(idle_time);
        /* Tell the scheduler how much we idled: */
        sched_clock_idle_wakeup_event(idle_time_ns);
 
@@ -1037,7 +1032,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
        cx->usage++;
 
        lapic_timer_state_broadcast(pr, cx, 0);
-       cx->time += sleep_ticks;
+       cx->time += idle_time;
        return idle_time;
 }
 
index 4ab2275b4461e797bf374880c97c24db72dba386..3fb4bdea7e06e59edcd5591897179895ce12807c 100644 (file)
@@ -94,11 +94,13 @@ void __init acpi_old_suspend_ordering(void)
 }
 
 /**
- *     acpi_pm_disable_gpes - Disable the GPEs.
+ * acpi_pm_freeze - Disable the GPEs and suspend EC transactions.
  */
-static int acpi_pm_disable_gpes(void)
+static int acpi_pm_freeze(void)
 {
        acpi_disable_all_gpes();
+       acpi_os_wait_events_complete(NULL);
+       acpi_ec_block_transactions();
        return 0;
 }
 
@@ -126,7 +128,8 @@ static int acpi_pm_prepare(void)
        int error = __acpi_pm_prepare();
 
        if (!error)
-               acpi_disable_all_gpes();
+               acpi_pm_freeze();
+
        return error;
 }
 
@@ -256,6 +259,8 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
         * acpi_leave_sleep_state will reenable specific GPEs later
         */
        acpi_disable_all_gpes();
+       /* Allow EC transactions to happen. */
+       acpi_ec_unblock_transactions_early();
 
        local_irq_restore(flags);
        printk(KERN_DEBUG "Back to C!\n");
@@ -267,6 +272,12 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
        return ACPI_SUCCESS(status) ? 0 : -EFAULT;
 }
 
+static void acpi_suspend_finish(void)
+{
+       acpi_ec_unblock_transactions();
+       acpi_pm_finish();
+}
+
 static int acpi_suspend_state_valid(suspend_state_t pm_state)
 {
        u32 acpi_state;
@@ -288,7 +299,7 @@ static struct platform_suspend_ops acpi_suspend_ops = {
        .begin = acpi_suspend_begin,
        .prepare_late = acpi_pm_prepare,
        .enter = acpi_suspend_enter,
-       .wake = acpi_pm_finish,
+       .wake = acpi_suspend_finish,
        .end = acpi_pm_end,
 };
 
@@ -314,9 +325,9 @@ static int acpi_suspend_begin_old(suspend_state_t pm_state)
 static struct platform_suspend_ops acpi_suspend_ops_old = {
        .valid = acpi_suspend_state_valid,
        .begin = acpi_suspend_begin_old,
-       .prepare_late = acpi_pm_disable_gpes,
+       .prepare_late = acpi_pm_freeze,
        .enter = acpi_suspend_enter,
-       .wake = acpi_pm_finish,
+       .wake = acpi_suspend_finish,
        .end = acpi_pm_end,
        .recover = acpi_pm_finish,
 };
@@ -433,6 +444,7 @@ static int acpi_hibernation_enter(void)
 static void acpi_hibernation_finish(void)
 {
        hibernate_nvs_free();
+       acpi_ec_unblock_transactions();
        acpi_pm_finish();
 }
 
@@ -453,19 +465,13 @@ static void acpi_hibernation_leave(void)
        }
        /* Restore the NVS memory area */
        hibernate_nvs_restore();
+       /* Allow EC transactions to happen. */
+       acpi_ec_unblock_transactions_early();
 }
 
-static int acpi_pm_pre_restore(void)
-{
-       acpi_disable_all_gpes();
-       acpi_os_wait_events_complete(NULL);
-       acpi_ec_suspend_transactions();
-       return 0;
-}
-
-static void acpi_pm_restore_cleanup(void)
+static void acpi_pm_thaw(void)
 {
-       acpi_ec_resume_transactions();
+       acpi_ec_unblock_transactions();
        acpi_enable_all_runtime_gpes();
 }
 
@@ -477,8 +483,8 @@ static struct platform_hibernation_ops acpi_hibernation_ops = {
        .prepare = acpi_pm_prepare,
        .enter = acpi_hibernation_enter,
        .leave = acpi_hibernation_leave,
-       .pre_restore = acpi_pm_pre_restore,
-       .restore_cleanup = acpi_pm_restore_cleanup,
+       .pre_restore = acpi_pm_freeze,
+       .restore_cleanup = acpi_pm_thaw,
 };
 
 /**
@@ -510,12 +516,9 @@ static int acpi_hibernation_begin_old(void)
 
 static int acpi_hibernation_pre_snapshot_old(void)
 {
-       int error = acpi_pm_disable_gpes();
-
-       if (!error)
-               hibernate_nvs_save();
-
-       return error;
+       acpi_pm_freeze();
+       hibernate_nvs_save();
+       return 0;
 }
 
 /*
@@ -527,11 +530,11 @@ static struct platform_hibernation_ops acpi_hibernation_ops_old = {
        .end = acpi_pm_end,
        .pre_snapshot = acpi_hibernation_pre_snapshot_old,
        .finish = acpi_hibernation_finish,
-       .prepare = acpi_pm_disable_gpes,
+       .prepare = acpi_pm_freeze,
        .enter = acpi_hibernation_enter,
        .leave = acpi_hibernation_leave,
-       .pre_restore = acpi_pm_pre_restore,
-       .restore_cleanup = acpi_pm_restore_cleanup,
+       .pre_restore = acpi_pm_freeze,
+       .restore_cleanup = acpi_pm_thaw,
        .recover = acpi_pm_finish,
 };
 #endif /* CONFIG_HIBERNATION */
index f09fc0e2062dfdf9b0d2c4d816cd4fada77c4628..7cfcc629a7fd0f89bf56995652aff7d888379549 100644 (file)
@@ -1123,6 +1123,7 @@ source "drivers/s390/char/Kconfig"
 
 config RAMOOPS
        tristate "Log panic/oops to a RAM buffer"
+       depends on HAS_IOMEM
        default n
        help
          This enables panic and oops messages to be logged to a circular
index c4161d5e053d383c74d79905dfdb8d3fef27868e..e4089c432f15fea5964418cdf8d765e47f39bb50 100644 (file)
@@ -904,9 +904,7 @@ static void gsm_dlci_data_sweep(struct gsm_mux *gsm)
        int len;
        /* Priority ordering: We should do priority with RR of the groups */
        int i = 1;
-       unsigned long flags;
 
-       spin_lock_irqsave(&gsm->tx_lock, flags);
        while (i < NUM_DLCI) {
                struct gsm_dlci *dlci;
 
@@ -927,7 +925,6 @@ static void gsm_dlci_data_sweep(struct gsm_mux *gsm)
                if (len == 0)
                        i++;
        }
-       spin_unlock_irqrestore(&gsm->tx_lock, flags);
 }
 
 /**
@@ -2230,12 +2227,16 @@ static int gsmld_open(struct tty_struct *tty)
 static void gsmld_write_wakeup(struct tty_struct *tty)
 {
        struct gsm_mux *gsm = tty->disc_data;
+       unsigned long flags;
 
        /* Queue poll */
        clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
        gsm_data_kick(gsm);
-       if (gsm->tx_bytes < TX_THRESH_LO)
+       if (gsm->tx_bytes < TX_THRESH_LO) {
+               spin_lock_irqsave(&gsm->tx_lock, flags);
                gsm_dlci_data_sweep(gsm);
+               spin_unlock_irqrestore(&gsm->tx_lock, flags);
+       }
 }
 
 /**
index 7cdb6ee569cd7ca592bedfea458f0b676ec937af..1296c42ed5c627d876adf3bc75e4e1a665cc8a1d 100644 (file)
@@ -304,7 +304,7 @@ static void scrup(struct vc_data *vc, unsigned int t, unsigned int b, int nr)
        d = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t);
        s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * (t + nr));
        scr_memmovew(d, s, (b - t - nr) * vc->vc_size_row);
-       scr_memsetw(d + (b - t - nr) * vc->vc_cols, vc->vc_video_erase_char,
+       scr_memsetw(d + (b - t - nr) * vc->vc_size_row, vc->vc_video_erase_char,
                    vc->vc_size_row * nr);
 }
 
index 6aa10284104aeb6e4bc3a22833ea347e67c5d976..cb19dbc52136426d3b869c089a7153de2c719c7f 100644 (file)
@@ -1303,7 +1303,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
                if (!perm)
                        goto eperm;
                ret = copy_from_user(&ui, up, sizeof(struct unimapinit));
-               if (!ret)
+               if (ret)
+                       ret = -EFAULT;
+               else
                        con_clear_unimap(vc, &ui);
                break;
              }
index db9cd0240c6f3f84bc89c65b1e5b8750ce4db116..2a1e804a71aa2466199119f2206133fdb409d932 100644 (file)
@@ -45,7 +45,7 @@
 
 MODULE_AUTHOR("VMware, Inc.");
 MODULE_DESCRIPTION("VMware Memory Control (Balloon) Driver");
-MODULE_VERSION("1.2.1.0-K");
+MODULE_VERSION("1.2.1.1-k");
 MODULE_ALIAS("dmi:*:svnVMware*:*");
 MODULE_ALIAS("vmware_vmmemctl");
 MODULE_LICENSE("GPL");
@@ -101,6 +101,8 @@ MODULE_LICENSE("GPL");
 /* Maximum number of page allocations without yielding processor */
 #define VMW_BALLOON_YIELD_THRESHOLD    1024
 
+/* Maximum number of refused pages we accumulate during inflation cycle */
+#define VMW_BALLOON_MAX_REFUSED                16
 
 /*
  * Hypervisor communication port definitions.
@@ -183,6 +185,7 @@ struct vmballoon {
 
        /* transient list of non-balloonable pages */
        struct list_head refused_pages;
+       unsigned int n_refused_pages;
 
        /* balloon size in pages */
        unsigned int size;
@@ -428,14 +431,21 @@ static int vmballoon_reserve_page(struct vmballoon *b, bool can_sleep)
                /* inform monitor */
                locked = vmballoon_send_lock_page(b, page_to_pfn(page));
                if (!locked) {
+                       STATS_INC(b->stats.refused_alloc);
+
                        if (b->reset_required) {
                                __free_page(page);
                                return -EIO;
                        }
 
-                       /* place on list of non-balloonable pages, retry allocation */
+                       /*
+                        * Place page on the list of non-balloonable pages
+                        * and retry allocation, unless we already accumulated
+                        * too many of them, in which case take a breather.
+                        */
                        list_add(&page->lru, &b->refused_pages);
-                       STATS_INC(b->stats.refused_alloc);
+                       if (++b->n_refused_pages >= VMW_BALLOON_MAX_REFUSED)
+                               return -EIO;
                }
        } while (!locked);
 
@@ -483,6 +493,8 @@ static void vmballoon_release_refused_pages(struct vmballoon *b)
                __free_page(page);
                STATS_INC(b->stats.refused_free);
        }
+
+       b->n_refused_pages = 0;
 }
 
 /*
index 2b281680e3206da99f9e991d69f12c5edef92754..d98ddcfac5e5cb2e0ddf1fd32fac9318cc09b29b 100644 (file)
@@ -1157,7 +1157,6 @@ static void mmc_omap_start_request(struct mmc_omap_host *host,
        mmc_omap_start_command(host, req->cmd);
        if (host->dma_in_use)
                omap_start_dma(host->dma_ch);
-       BUG_ON(irqs_disabled());
 }
 
 static void mmc_omap_request(struct mmc_host *mmc, struct mmc_request *req)
index e5972b2c17b7be04be983a4460ca5aec5c7063d2..70b68d35f9694c804272c1bca502253f15a563c9 100644 (file)
@@ -495,8 +495,6 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
        pr_debug("s3c2410_rtc: RTCCON=%02x\n",
                 readb(s3c_rtc_base + S3C2410_RTCCON));
 
-       s3c_rtc_setfreq(&pdev->dev, 1);
-
        device_init_wakeup(&pdev->dev, 1);
 
        /* register RTC and exit */
@@ -510,14 +508,17 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
                goto err_nortc;
        }
 
+       s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
+
        if (s3c_rtc_cpu_type == TYPE_S3C64XX)
                rtc->max_user_freq = 32768;
        else
                rtc->max_user_freq = 128;
 
-       s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
-
        platform_set_drvdata(pdev, rtc);
+
+       s3c_rtc_setfreq(&pdev->dev, 1);
+
        return 0;
 
  err_nortc:
index 01c012da4e26d01eef7c9cfeb87b71a26e1f1bd6..746a44621d9157e3a50448ce60e577d66dfc1246 100644 (file)
@@ -982,6 +982,18 @@ static int skip_tx_en_setup(struct serial_private *priv,
 #define PCI_SUBDEVICE_ID_POCTAL422     0x0408
 #define PCI_VENDOR_ID_ADVANTECH                0x13fe
 #define PCI_DEVICE_ID_ADVANTECH_PCI3620        0x3620
+#define PCI_DEVICE_ID_TITAN_200I       0x8028
+#define PCI_DEVICE_ID_TITAN_400I       0x8048
+#define PCI_DEVICE_ID_TITAN_800I       0x8088
+#define PCI_DEVICE_ID_TITAN_800EH      0xA007
+#define PCI_DEVICE_ID_TITAN_800EHB     0xA008
+#define PCI_DEVICE_ID_TITAN_400EH      0xA009
+#define PCI_DEVICE_ID_TITAN_100E       0xA010
+#define PCI_DEVICE_ID_TITAN_200E       0xA012
+#define PCI_DEVICE_ID_TITAN_400E       0xA013
+#define PCI_DEVICE_ID_TITAN_800E       0xA014
+#define PCI_DEVICE_ID_TITAN_200EI      0xA016
+#define PCI_DEVICE_ID_TITAN_200EISI    0xA017
 
 /* Unknown vendors/cards - this should not be in linux/pci_ids.h */
 #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584        0x1584
@@ -1541,6 +1553,10 @@ enum pci_board_num_t {
        pbn_b3_4_115200,
        pbn_b3_8_115200,
 
+       pbn_b4_bt_2_921600,
+       pbn_b4_bt_4_921600,
+       pbn_b4_bt_8_921600,
+
        /*
         * Board-specific versions.
         */
@@ -1995,6 +2011,25 @@ static struct pciserial_board pci_boards[] __devinitdata = {
                .uart_offset    = 8,
        },
 
+       [pbn_b4_bt_2_921600] = {
+               .flags          = FL_BASE4,
+               .num_ports      = 2,
+               .base_baud      = 921600,
+               .uart_offset    = 8,
+       },
+       [pbn_b4_bt_4_921600] = {
+               .flags          = FL_BASE4,
+               .num_ports      = 4,
+               .base_baud      = 921600,
+               .uart_offset    = 8,
+       },
+       [pbn_b4_bt_8_921600] = {
+               .flags          = FL_BASE4,
+               .num_ports      = 8,
+               .base_baud      = 921600,
+               .uart_offset    = 8,
+       },
+
        /*
         * Entries following this are board-specific.
         */
@@ -3043,6 +3078,42 @@ static struct pci_device_id serial_pci_tbl[] = {
        {       PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800L,
                PCI_ANY_ID, PCI_ANY_ID, 0, 0,
                pbn_b0_bt_8_921600 },
+       {       PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200I,
+               PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+               pbn_b4_bt_2_921600 },
+       {       PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400I,
+               PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+               pbn_b4_bt_4_921600 },
+       {       PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800I,
+               PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+               pbn_b4_bt_8_921600 },
+       {       PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400EH,
+               PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+               pbn_b0_4_921600 },
+       {       PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800EH,
+               PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+               pbn_b0_4_921600 },
+       {       PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800EHB,
+               PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+               pbn_b0_4_921600 },
+       {       PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_100E,
+               PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+               pbn_oxsemi_1_4000000 },
+       {       PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200E,
+               PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+               pbn_oxsemi_2_4000000 },
+       {       PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400E,
+               PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+               pbn_oxsemi_4_4000000 },
+       {       PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800E,
+               PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+               pbn_oxsemi_8_4000000 },
+       {       PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200EI,
+               PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+               pbn_oxsemi_2_4000000 },
+       {       PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200EISI,
+               PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+               pbn_oxsemi_2_4000000 },
 
        {       PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_550,
                PCI_ANY_ID, PCI_ANY_ID, 0, 0,
index bcee156d2f2eb32edc3f9f1d60a55e545875663a..0f1189605d2141b2516b48c6ecd6ed6ee7c287ec 100644 (file)
@@ -89,15 +89,12 @@ static unsigned int altera_uart_tx_empty(struct uart_port *port)
 static unsigned int altera_uart_get_mctrl(struct uart_port *port)
 {
        struct altera_uart *pp = container_of(port, struct altera_uart, port);
-       unsigned long flags;
        unsigned int sigs;
 
-       spin_lock_irqsave(&port->lock, flags);
        sigs =
            (readl(port->membase + ALTERA_UART_STATUS_REG) &
             ALTERA_UART_STATUS_CTS_MSK) ? TIOCM_CTS : 0;
        sigs |= (pp->sigs & TIOCM_RTS);
-       spin_unlock_irqrestore(&port->lock, flags);
 
        return sigs;
 }
@@ -105,49 +102,37 @@ static unsigned int altera_uart_get_mctrl(struct uart_port *port)
 static void altera_uart_set_mctrl(struct uart_port *port, unsigned int sigs)
 {
        struct altera_uart *pp = container_of(port, struct altera_uart, port);
-       unsigned long flags;
 
-       spin_lock_irqsave(&port->lock, flags);
        pp->sigs = sigs;
        if (sigs & TIOCM_RTS)
                pp->imr |= ALTERA_UART_CONTROL_RTS_MSK;
        else
                pp->imr &= ~ALTERA_UART_CONTROL_RTS_MSK;
        writel(pp->imr, port->membase + ALTERA_UART_CONTROL_REG);
-       spin_unlock_irqrestore(&port->lock, flags);
 }
 
 static void altera_uart_start_tx(struct uart_port *port)
 {
        struct altera_uart *pp = container_of(port, struct altera_uart, port);
-       unsigned long flags;
 
-       spin_lock_irqsave(&port->lock, flags);
        pp->imr |= ALTERA_UART_CONTROL_TRDY_MSK;
        writel(pp->imr, port->membase + ALTERA_UART_CONTROL_REG);
-       spin_unlock_irqrestore(&port->lock, flags);
 }
 
 static void altera_uart_stop_tx(struct uart_port *port)
 {
        struct altera_uart *pp = container_of(port, struct altera_uart, port);
-       unsigned long flags;
 
-       spin_lock_irqsave(&port->lock, flags);
        pp->imr &= ~ALTERA_UART_CONTROL_TRDY_MSK;
        writel(pp->imr, port->membase + ALTERA_UART_CONTROL_REG);
-       spin_unlock_irqrestore(&port->lock, flags);
 }
 
 static void altera_uart_stop_rx(struct uart_port *port)
 {
        struct altera_uart *pp = container_of(port, struct altera_uart, port);
-       unsigned long flags;
 
-       spin_lock_irqsave(&port->lock, flags);
        pp->imr &= ~ALTERA_UART_CONTROL_RRDY_MSK;
        writel(pp->imr, port->membase + ALTERA_UART_CONTROL_REG);
-       spin_unlock_irqrestore(&port->lock, flags);
 }
 
 static void altera_uart_break_ctl(struct uart_port *port, int break_state)
@@ -272,10 +257,14 @@ static irqreturn_t altera_uart_interrupt(int irq, void *data)
        unsigned int isr;
 
        isr = readl(port->membase + ALTERA_UART_STATUS_REG) & pp->imr;
+
+       spin_lock(&port->lock);
        if (isr & ALTERA_UART_STATUS_RRDY_MSK)
                altera_uart_rx_chars(pp);
        if (isr & ALTERA_UART_STATUS_TRDY_MSK)
                altera_uart_tx_chars(pp);
+       spin_unlock(&port->lock);
+
        return IRQ_RETVAL(isr);
 }
 
@@ -402,31 +391,24 @@ int __init early_altera_uart_setup(struct altera_uart_platform_uart *platp)
        return 0;
 }
 
-static void altera_uart_console_putc(struct console *co, const char c)
+static void altera_uart_console_putc(struct uart_port *port, const char c)
 {
-       struct uart_port *port = &(altera_uart_ports + co->index)->port;
-       int i;
+       while (!(readl(port->membase + ALTERA_UART_STATUS_REG) &
+                ALTERA_UART_STATUS_TRDY_MSK))
+               cpu_relax();
 
-       for (i = 0; i < 0x10000; i++) {
-               if (readl(port->membase + ALTERA_UART_STATUS_REG) &
-                   ALTERA_UART_STATUS_TRDY_MSK)
-                       break;
-       }
        writel(c, port->membase + ALTERA_UART_TXDATA_REG);
-       for (i = 0; i < 0x10000; i++) {
-               if (readl(port->membase + ALTERA_UART_STATUS_REG) &
-                   ALTERA_UART_STATUS_TRDY_MSK)
-                       break;
-       }
 }
 
 static void altera_uart_console_write(struct console *co, const char *s,
                                      unsigned int count)
 {
+       struct uart_port *port = &(altera_uart_ports + co->index)->port;
+
        for (; count; count--, s++) {
-               altera_uart_console_putc(co, *s);
+               altera_uart_console_putc(port, *s);
                if (*s == '\n')
-                       altera_uart_console_putc(co, '\r');
+                       altera_uart_console_putc(port, '\r');
        }
 }
 
@@ -516,7 +498,7 @@ static int __devinit altera_uart_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int altera_uart_remove(struct platform_device *pdev)
+static int __devexit altera_uart_remove(struct platform_device *pdev)
 {
        struct uart_port *port;
        int i;
index 96f7e7484feebf4269c631862f9a01b227eac0f6..511cbf68787782ce9b782f85ae51a0b5a80df5a6 100644 (file)
@@ -797,7 +797,7 @@ static void bfin_serial_shutdown(struct uart_port *port)
                gpio_free(uart->rts_pin);
 #endif
 #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
-       if (UART_GET_IER(uart) && EDSSI)
+       if (UART_GET_IER(uart) & EDSSI)
                free_irq(uart->status_irq, uart);
 #endif
 }
@@ -869,7 +869,12 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
        }
 
        baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
-       quot = uart_get_divisor(port, baud) - ANOMALY_05000230;
+       quot = uart_get_divisor(port, baud);
+
+       /* If discipline is not IRDA, apply ANOMALY_05000230 */
+       if (termios->c_line != N_IRDA)
+               quot -= ANOMALY_05000230;
+
        spin_lock_irqsave(&uart->port.lock, flags);
 
        UART_SET_ANOMALY_THRESHOLD(uart, USEC_PER_SEC / baud * 15);
index ecdc0facf7ee9928fd4354a0e2a52e5d611b6acb..f8c816e7725de2152f9f80b50a0962c6f88c82e4 100644 (file)
@@ -41,19 +41,6 @@ struct msm_port {
        unsigned int            imr;
 };
 
-#define UART_TO_MSM(uart_port) ((struct msm_port *) uart_port)
-
-static inline void msm_write(struct uart_port *port, unsigned int val,
-                            unsigned int off)
-{
-       __raw_writel(val, port->membase + off);
-}
-
-static inline unsigned int msm_read(struct uart_port *port, unsigned int off)
-{
-       return __raw_readl(port->membase + off);
-}
-
 static void msm_stop_tx(struct uart_port *port)
 {
        struct msm_port *msm_port = UART_TO_MSM(port);
@@ -320,11 +307,7 @@ static void msm_init_clock(struct uart_port *port)
        struct msm_port *msm_port = UART_TO_MSM(port);
 
        clk_enable(msm_port->clk);
-
-       msm_write(port, 0xC0, UART_MREG);
-       msm_write(port, 0xB2, UART_NREG);
-       msm_write(port, 0x7D, UART_DREG);
-       msm_write(port, 0x1C, UART_MNDREG);
+       msm_serial_set_mnd_regs(port);
 }
 
 static int msm_startup(struct uart_port *port)
@@ -706,6 +689,8 @@ static int __init msm_serial_probe(struct platform_device *pdev)
        if (unlikely(IS_ERR(msm_port->clk)))
                return PTR_ERR(msm_port->clk);
        port->uartclk = clk_get_rate(msm_port->clk);
+       printk(KERN_INFO "uartclk = %d\n", port->uartclk);
+
 
        resource = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        if (unlikely(!resource))
index 689f1fa0e84e2370254bc0570e7a841e98184b23..f6ca9ca79e98f34be24525596f1b38fe5c5f31a3 100644 (file)
 #define UART_MISR      0x0010
 #define UART_ISR       0x0014
 
+#define UART_TO_MSM(uart_port) ((struct msm_port *) uart_port)
+
+static inline
+void msm_write(struct uart_port *port, unsigned int val, unsigned int off)
+{
+       __raw_writel(val, port->membase + off);
+}
+
+static inline
+unsigned int msm_read(struct uart_port *port, unsigned int off)
+{
+       return __raw_readl(port->membase + off);
+}
+
+/*
+ * Setup the MND registers to use the TCXO clock.
+ */
+static inline void msm_serial_set_mnd_regs_tcxo(struct uart_port *port)
+{
+       msm_write(port, 0x06, UART_MREG);
+       msm_write(port, 0xF1, UART_NREG);
+       msm_write(port, 0x0F, UART_DREG);
+       msm_write(port, 0x1A, UART_MNDREG);
+}
+
+/*
+ * Setup the MND registers to use the TCXO clock divided by 4.
+ */
+static inline void msm_serial_set_mnd_regs_tcxoby4(struct uart_port *port)
+{
+       msm_write(port, 0x18, UART_MREG);
+       msm_write(port, 0xF6, UART_NREG);
+       msm_write(port, 0x0F, UART_DREG);
+       msm_write(port, 0x0A, UART_MNDREG);
+}
+
+static inline
+void msm_serial_set_mnd_regs_from_uartclk(struct uart_port *port)
+{
+       if (port->uartclk == 19200000)
+               msm_serial_set_mnd_regs_tcxo(port);
+       else
+               msm_serial_set_mnd_regs_tcxoby4(port);
+}
+
+/*
+ * TROUT has a specific defect that makes it report it's uartclk
+ * as 19.2Mhz (TCXO) when it's actually 4.8Mhz (TCXO/4). This special
+ * cases TROUT to use the right clock.
+ */
+#ifdef CONFIG_MACH_TROUT
+#define msm_serial_set_mnd_regs msm_serial_set_mnd_regs_tcxoby4
+#else
+#define msm_serial_set_mnd_regs msm_serial_set_mnd_regs_from_uartclk
+#endif
+
 #endif /* __DRIVERS_SERIAL_MSM_SERIAL_H */
index dadd686c98012e545bf90d07a61447853630818d..526307368f8be5f8c1a1a553b01ac83799db2ffa 100644 (file)
@@ -715,6 +715,8 @@ static struct pcmcia_device_id serial_ids[] = {
        PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0057, 0x0021),
        PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0089, 0x110a),
        PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0104, 0x000a),
+       PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0105, 0x0d0a),
+       PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0105, 0x0e0a),
        PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0105, 0xea15),
        PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0109, 0x0501),
        PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0138, 0x110a),
@@ -724,8 +726,6 @@ static struct pcmcia_device_id serial_ids[] = {
        PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x016c, 0x0081),
        PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x021b, 0x0101),
        PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x08a1, 0xc0ab),
-       PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0105, 0x0d0a),
-       PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0105, 0x0e0a),
        PCMCIA_PFC_DEVICE_PROD_ID123(1, "MEGAHERTZ", "CC/XJEM3288", "DATA/FAX/CELL ETHERNET MODEM", 0xf510db04, 0x04cd2988, 0x46a52d63),
        PCMCIA_PFC_DEVICE_PROD_ID123(1, "MEGAHERTZ", "CC/XJEM3336", "DATA/FAX/CELL ETHERNET MODEM", 0xf510db04, 0x0143b773, 0x46a52d63),
        PCMCIA_PFC_DEVICE_PROD_ID123(1, "MEGAHERTZ", "EM1144T", "PCMCIA MODEM", 0xf510db04, 0x856d66c8, 0xbd6c43ef),
@@ -768,17 +768,26 @@ static struct pcmcia_device_id serial_ids[] = {
        PCMCIA_DEVICE_MANF_CARD(0x00a4, 0x0276),
        PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0039),
        PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0006),
+       PCMCIA_DEVICE_MANF_CARD(0x0105, 0x0101), /* TDK DF2814 */
+       PCMCIA_DEVICE_MANF_CARD(0x0105, 0x100a), /* Xircom CM-56G */
+       PCMCIA_DEVICE_MANF_CARD(0x0105, 0x3e0a), /* TDK DF5660 */
        PCMCIA_DEVICE_MANF_CARD(0x0105, 0x410a),
+       PCMCIA_DEVICE_MANF_CARD(0x0107, 0x0002), /* USRobotics 14,400 */
        PCMCIA_DEVICE_MANF_CARD(0x010b, 0x0d50),
        PCMCIA_DEVICE_MANF_CARD(0x010b, 0x0d51),
        PCMCIA_DEVICE_MANF_CARD(0x010b, 0x0d52),
        PCMCIA_DEVICE_MANF_CARD(0x010b, 0x0d53),
        PCMCIA_DEVICE_MANF_CARD(0x010b, 0xd180),
+       PCMCIA_DEVICE_MANF_CARD(0x0115, 0x3330), /* USRobotics/SUN 14,400 */
+       PCMCIA_DEVICE_MANF_CARD(0x0124, 0x0100), /* Nokia DTP-2 ver II */
+       PCMCIA_DEVICE_MANF_CARD(0x0134, 0x5600), /* LASAT COMMUNICATIONS A/S */
        PCMCIA_DEVICE_MANF_CARD(0x0137, 0x000e),
        PCMCIA_DEVICE_MANF_CARD(0x0137, 0x001b),
        PCMCIA_DEVICE_MANF_CARD(0x0137, 0x0025),
        PCMCIA_DEVICE_MANF_CARD(0x0137, 0x0045),
        PCMCIA_DEVICE_MANF_CARD(0x0137, 0x0052),
+       PCMCIA_DEVICE_MANF_CARD(0x016c, 0x0006), /* Psion 56K+Fax */
+       PCMCIA_DEVICE_MANF_CARD(0x0200, 0x0001), /* MultiMobile */
        PCMCIA_DEVICE_PROD_ID134("ADV", "TECH", "COMpad-32/85", 0x67459937, 0x916d02ba, 0x8fbe92ae),
        PCMCIA_DEVICE_PROD_ID124("GATEWAY2000", "CC3144", "PCMCIA MODEM", 0x506bccae, 0xcb3685f1, 0xbd6c43ef),
        PCMCIA_DEVICE_PROD_ID14("MEGAHERTZ", "PCMCIA MODEM", 0xf510db04, 0xbd6c43ef),
@@ -792,16 +801,21 @@ static struct pcmcia_device_id serial_ids[] = {
        PCMCIA_DEVICE_PROD_ID12("COMPAQ", "PCMCIA 33600 FAX/DATA MODEM", 0xa3a3062c, 0x5a00ce95),
        PCMCIA_DEVICE_PROD_ID12("Computerboards, Inc.", "PCM-COM422", 0xd0b78f51, 0x7e2d49ed),
        PCMCIA_DEVICE_PROD_ID12("Dr. Neuhaus", "FURY CARD 14K4", 0x76942813, 0x8b96ce65),
+       PCMCIA_DEVICE_PROD_ID12("IBM", "ISDN/56K/GSM", 0xb569a6e5, 0xfee5297b),
        PCMCIA_DEVICE_PROD_ID12("Intelligent", "ANGIA FAX/MODEM", 0xb496e65e, 0xf31602a6),
        PCMCIA_DEVICE_PROD_ID12("Intel", "MODEM 2400+", 0x816cc815, 0x412729fb),
+       PCMCIA_DEVICE_PROD_ID12("Intertex", "IX34-PCMCIA", 0xf8a097e3, 0x97880447),
        PCMCIA_DEVICE_PROD_ID12("IOTech Inc ", "PCMCIA Dual RS-232 Serial Port Card", 0x3bd2d898, 0x92abc92f),
        PCMCIA_DEVICE_PROD_ID12("MACRONIX", "FAX/MODEM", 0x668388b3, 0x3f9bdf2f),
        PCMCIA_DEVICE_PROD_ID12("Multi-Tech", "MT1432LT", 0x5f73be51, 0x0b3e2383),
        PCMCIA_DEVICE_PROD_ID12("Multi-Tech", "MT2834LT", 0x5f73be51, 0x4cd7c09e),
        PCMCIA_DEVICE_PROD_ID12("OEM      ", "C288MX     ", 0xb572d360, 0xd2385b7a),
+       PCMCIA_DEVICE_PROD_ID12("Option International", "V34bis GSM/PSTN Data/Fax Modem", 0x9d7cd6f5, 0x5cb8bf41),
        PCMCIA_DEVICE_PROD_ID12("PCMCIA   ", "C336MX     ", 0x99bcafe9, 0xaa25bcab),
        PCMCIA_DEVICE_PROD_ID12("Quatech Inc", "PCMCIA Dual RS-232 Serial Port Card", 0xc4420b35, 0x92abc92f),
        PCMCIA_DEVICE_PROD_ID12("Quatech Inc", "Dual RS-232 Serial Port PC Card", 0xc4420b35, 0x031a380d),
+       PCMCIA_DEVICE_PROD_ID12("Telia", "SurfinBird 560P/A+", 0xe2cdd5e, 0xc9314b38),
+       PCMCIA_DEVICE_PROD_ID1("Smart Serial Port", 0x2d8ce292),
        PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "PCMCIA", "EN2218-LAN/MODEM", 0x281f1c5d, 0x570f348e, "cis/PCMLM28.cis"),
        PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "PCMCIA", "UE2218-LAN/MODEM", 0x281f1c5d, 0x6fdcacee, "cis/PCMLM28.cis"),
        PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "Psion Dacom", "Gold Card V34 Ethernet", 0xf5f025c2, 0x338e8155, "cis/PCMLM28.cis"),
index 005195958647b03acded28a822bfd7374744d210..ceba593dc84fbcb994f1fb4968cab3b4adf05b83 100644 (file)
@@ -441,8 +441,10 @@ struct sfi_table_attr __init *sfi_sysfs_install_table(u64 pa)
 
        ret = sysfs_create_bin_file(tables_kobj,
                                  &tbl_attr->attr);
-       if (ret)
+       if (ret) {
                kfree(tbl_attr);
+               tbl_attr = NULL;
+       }
 
        sfi_unmap_table(th);
        return tbl_attr;
index 0c2f14ff96968e9e910d353662932727177d9367..61d75507d5d0e8f385019f0917ef8f4f6b726ecb 100644 (file)
@@ -1201,7 +1201,7 @@ made_compressed_probe:
                if (rcv->urb == NULL) {
                        dev_dbg(&intf->dev,
                                "out of memory (read urbs usb_alloc_urb)\n");
-                       goto alloc_fail7;
+                       goto alloc_fail6;
                }
 
                rcv->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
@@ -1225,7 +1225,7 @@ made_compressed_probe:
                if (snd->urb == NULL) {
                        dev_dbg(&intf->dev,
                                "out of memory (write urbs usb_alloc_urb)");
-                       goto alloc_fail7;
+                       goto alloc_fail8;
                }
 
                if (usb_endpoint_xfer_int(epwrite))
@@ -1264,6 +1264,7 @@ made_compressed_probe:
                i = device_create_file(&intf->dev,
                                                &dev_attr_iCountryCodeRelDate);
                if (i < 0) {
+                       device_remove_file(&intf->dev, &dev_attr_wCountryCodes);
                        kfree(acm->country_codes);
                        goto skip_countries;
                }
@@ -1300,6 +1301,7 @@ alloc_fail8:
                usb_free_urb(acm->wb[i].urb);
 alloc_fail7:
        acm_read_buffers_free(acm);
+alloc_fail6:
        for (i = 0; i < num_rx_buf; i++)
                usb_free_urb(acm->ru[i].urb);
        usb_free_urb(acm->ctrlurb);
index ded550eda5d967fbd2f91f34fab08458cf964d89..de98a94d18537835fafad621fe213c78bba00a61 100644 (file)
@@ -1328,6 +1328,7 @@ int usb_resume(struct device *dev, pm_message_t msg)
 
        /* For all other calls, take the device back to full power and
         * tell the PM core in case it was autosuspended previously.
+        * Unbind the interfaces that will need rebinding later.
         */
        } else {
                status = usb_resume_both(udev, msg);
@@ -1336,6 +1337,7 @@ int usb_resume(struct device *dev, pm_message_t msg)
                        pm_runtime_set_active(dev);
                        pm_runtime_enable(dev);
                        udev->last_busy = jiffies;
+                       do_unbind_rebind(udev, DO_REBIND);
                }
        }
 
index 649c0c5f7158d57cf1bdc3d7c382a10330cc4f63..591ae9fde1993db406d32626cf1aac3df9c36b57 100644 (file)
@@ -295,6 +295,7 @@ config USB_GADGET_S3C_HSOTG
        boolean "S3C HS/OtG USB Device controller"
        depends on S3C_DEV_USB_HSOTG
        select USB_GADGET_S3C_HSOTG_PIO
+       select USB_GADGET_DUALSPEED
        help
          The Samsung S3C64XX USB2.0 high-speed gadget controller
          integrated into the S3C64XX series SoC.
index 43bf44514c417d0431b52604569bef796871248b..b91115f84b137e69b539b6c09a6f76de2afc3dc0 100644 (file)
@@ -101,7 +101,7 @@ static struct uac_feature_unit_descriptor_0 feature_unit_desc = {
 static struct usb_audio_control mute_control = {
        .list = LIST_HEAD_INIT(mute_control.list),
        .name = "Mute Control",
-       .type = UAC_MUTE_CONTROL,
+       .type = UAC_FU_MUTE,
        /* Todo: add real Mute control code */
        .set = generic_set_cmd,
        .get = generic_get_cmd,
@@ -110,7 +110,7 @@ static struct usb_audio_control mute_control = {
 static struct usb_audio_control volume_control = {
        .list = LIST_HEAD_INIT(volume_control.list),
        .name = "Volume Control",
-       .type = UAC_VOLUME_CONTROL,
+       .type = UAC_FU_VOLUME,
        /* Todo: add real Volume control code */
        .set = generic_set_cmd,
        .get = generic_get_cmd,
index 1f73b485732d1b74028064e37193ce6f56021718..26193eceb3231d48c06e98b29a09cf9849b319f5 100644 (file)
@@ -297,6 +297,12 @@ static void s3c_hsotg_ctrl_epint(struct s3c_hsotg *hsotg,
  */
 static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg)
 {
+       unsigned int ep;
+       unsigned int addr;
+       unsigned int size;
+       int timeout;
+       u32 val;
+
        /* the ryu 2.6.24 release ahs
           writel(0x1C0, hsotg->regs + S3C_GRXFSIZ);
           writel(S3C_GNPTXFSIZ_NPTxFStAddr(0x200) |
@@ -310,6 +316,51 @@ static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg)
        writel(S3C_GNPTXFSIZ_NPTxFStAddr(2048) |
               S3C_GNPTXFSIZ_NPTxFDep(0x1C0),
               hsotg->regs + S3C_GNPTXFSIZ);
+
+       /* arange all the rest of the TX FIFOs, as some versions of this
+        * block have overlapping default addresses. This also ensures
+        * that if the settings have been changed, then they are set to
+        * known values. */
+
+       /* start at the end of the GNPTXFSIZ, rounded up */
+       addr = 2048 + 1024;
+       size = 768;
+
+       /* currently we allocate TX FIFOs for all possible endpoints,
+        * and assume that they are all the same size. */
+
+       for (ep = 0; ep <= 15; ep++) {
+               val = addr;
+               val |= size << S3C_DPTXFSIZn_DPTxFSize_SHIFT;
+               addr += size;
+
+               writel(val, hsotg->regs + S3C_DPTXFSIZn(ep));
+       }
+
+       /* according to p428 of the design guide, we need to ensure that
+        * all fifos are flushed before continuing */
+
+       writel(S3C_GRSTCTL_TxFNum(0x10) | S3C_GRSTCTL_TxFFlsh |
+              S3C_GRSTCTL_RxFFlsh, hsotg->regs + S3C_GRSTCTL);
+
+       /* wait until the fifos are both flushed */
+       timeout = 100;
+       while (1) {
+               val = readl(hsotg->regs + S3C_GRSTCTL);
+
+               if ((val & (S3C_GRSTCTL_TxFFlsh | S3C_GRSTCTL_RxFFlsh)) == 0)
+                       break;
+
+               if (--timeout == 0) {
+                       dev_err(hsotg->dev,
+                               "%s: timeout flushing fifos (GRSTCTL=%08x)\n",
+                               __func__, val);
+               }
+
+               udelay(1);
+       }
+
+       dev_dbg(hsotg->dev, "FIFOs reset, timeout at %d\n", timeout);
 }
 
 /**
@@ -2574,6 +2625,9 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
        writel(S3C_DCTL_CGOUTNak | S3C_DCTL_CGNPInNAK,
               hsotg->regs + S3C_DCTL);
 
+       /* must be at-least 3ms to allow bus to see disconnect */
+       msleep(3);
+
        /* remove the soft-disconnect and let's go */
        __bic32(hsotg->regs + S3C_DCTL, S3C_DCTL_SftDiscon);
 
@@ -2730,6 +2784,9 @@ static void s3c_hsotg_init(struct s3c_hsotg *hsotg)
 
        writel(0, hsotg->regs + S3C_DAINTMSK);
 
+       /* Be in disconnected state until gadget is registered */
+       __orr32(hsotg->regs + S3C_DCTL, S3C_DCTL_SftDiscon);
+
        if (0) {
                /* post global nak until we're ready */
                writel(S3C_DCTL_SGNPInNAK | S3C_DCTL_SGOUTNak,
index ef3e88f0b3c307c0d605ad6f77b70407e90ae829..a3ef2a9d9dc2793c127994838abdd13eb8248b3f 100644 (file)
@@ -1135,7 +1135,7 @@ MODULE_LICENSE ("GPL");
 
 #ifdef CONFIG_XPS_USB_HCD_XILINX
 #include "ehci-xilinx-of.c"
-#define OF_PLATFORM_DRIVER     ehci_hcd_xilinx_of_driver
+#define XILINX_OF_PLATFORM_DRIVER      ehci_hcd_xilinx_of_driver
 #endif
 
 #ifdef CONFIG_PLAT_ORION
@@ -1159,7 +1159,8 @@ MODULE_LICENSE ("GPL");
 #endif
 
 #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \
-    !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER)
+    !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER) && \
+    !defined(XILINX_OF_PLATFORM_DRIVER)
 #error "missing bus glue for ehci-hcd"
 #endif
 
@@ -1213,10 +1214,20 @@ static int __init ehci_hcd_init(void)
        if (retval < 0)
                goto clean3;
 #endif
+
+#ifdef XILINX_OF_PLATFORM_DRIVER
+       retval = of_register_platform_driver(&XILINX_OF_PLATFORM_DRIVER);
+       if (retval < 0)
+               goto clean4;
+#endif
        return retval;
 
+#ifdef XILINX_OF_PLATFORM_DRIVER
+       /* of_unregister_platform_driver(&XILINX_OF_PLATFORM_DRIVER); */
+clean4:
+#endif
 #ifdef OF_PLATFORM_DRIVER
-       /* of_unregister_platform_driver(&OF_PLATFORM_DRIVER); */
+       of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
 clean3:
 #endif
 #ifdef PS3_SYSTEM_BUS_DRIVER
@@ -1243,6 +1254,9 @@ module_init(ehci_hcd_init);
 
 static void __exit ehci_hcd_cleanup(void)
 {
+#ifdef XILINX_OF_PLATFORM_DRIVER
+       of_unregister_platform_driver(&XILINX_OF_PLATFORM_DRIVER);
+#endif
 #ifdef OF_PLATFORM_DRIVER
        of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
 #endif
index 5151516ea1dee98a093b35cee1b89f4bca3cd457..d995351f9bed8cf31d07fb9163a328f22cf88aa6 100644 (file)
@@ -65,7 +65,7 @@ static inline void delayed_insw(unsigned int addr, void *buf, int len)
        unsigned short *bp = (unsigned short *)buf;
        while (len--) {
                DUMMY_DELAY_ACCESS;
-               *bp++ = inw((void *)addr);
+               *bp++ = inw(addr);
        }
 }
 
index edffd81fc253f390e8bf3b42e1fab702bb2baae1..11482b6b938152bcb4ff1b752f031dce1cc71ba3 100644 (file)
@@ -78,6 +78,8 @@ static int xhci_pci_setup(struct usb_hcd *hcd)
                        xhci_dbg(xhci, "QUIRK: Fresco Logic xHC needs configure"
                                        " endpoint cmd after reset endpoint\n");
        }
+       if (pdev->vendor == PCI_VENDOR_ID_NEC)
+               xhci->quirks |= XHCI_NEC_HOST;
 
        /* Make sure the HC is halted. */
        retval = xhci_halt(xhci);
index 36c858e5b529136d8ec76af58454f466a10de793..9012098add6baefada9cd6155d57be8f9708afd7 100644 (file)
@@ -1071,6 +1071,15 @@ bandwidth_change:
                        xhci_warn(xhci, "Reset device command completion "
                                        "for disabled slot %u\n", slot_id);
                break;
+       case TRB_TYPE(TRB_NEC_GET_FW):
+               if (!(xhci->quirks & XHCI_NEC_HOST)) {
+                       xhci->error_bitmask |= 1 << 6;
+                       break;
+               }
+               xhci_dbg(xhci, "NEC firmware version %2x.%02x\n",
+                               NEC_FW_MAJOR(event->status),
+                               NEC_FW_MINOR(event->status));
+               break;
        default:
                /* Skip over unknown commands on the event ring */
                xhci->error_bitmask |= 1 << 6;
@@ -1079,6 +1088,17 @@ bandwidth_change:
        inc_deq(xhci, xhci->cmd_ring, false);
 }
 
+static void handle_vendor_event(struct xhci_hcd *xhci,
+               union xhci_trb *event)
+{
+       u32 trb_type;
+
+       trb_type = TRB_FIELD_TO_TYPE(event->generic.field[3]);
+       xhci_dbg(xhci, "Vendor specific event TRB type = %u\n", trb_type);
+       if (trb_type == TRB_NEC_CMD_COMP && (xhci->quirks & XHCI_NEC_HOST))
+               handle_cmd_completion(xhci, &event->event_cmd);
+}
+
 static void handle_port_status(struct xhci_hcd *xhci,
                union xhci_trb *event)
 {
@@ -1659,7 +1679,10 @@ void xhci_handle_event(struct xhci_hcd *xhci)
                        update_ptrs = 0;
                break;
        default:
-               xhci->error_bitmask |= 1 << 3;
+               if ((event->event_cmd.flags & TRB_TYPE_BITMASK) >= TRB_TYPE(48))
+                       handle_vendor_event(xhci, event);
+               else
+                       xhci->error_bitmask |= 1 << 3;
        }
        /* Any of the above functions may drop and re-acquire the lock, so check
         * to make sure a watchdog timer didn't mark the host as non-responsive.
@@ -2378,6 +2401,12 @@ int xhci_queue_address_device(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr,
                        false);
 }
 
+int xhci_queue_vendor_command(struct xhci_hcd *xhci,
+               u32 field1, u32 field2, u32 field3, u32 field4)
+{
+       return queue_command(xhci, field1, field2, field3, field4, false);
+}
+
 /* Queue a reset device command TRB */
 int xhci_queue_reset_device(struct xhci_hcd *xhci, u32 slot_id)
 {
index 40e0a0c221b82cddfbcb6875f87cdaafcf390c16..27345cd04da0ccf99335064e2f37ad0950fb511f 100644 (file)
@@ -105,6 +105,33 @@ int xhci_halt(struct xhci_hcd *xhci)
                        STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC);
 }
 
+/*
+ * Set the run bit and wait for the host to be running.
+ */
+int xhci_start(struct xhci_hcd *xhci)
+{
+       u32 temp;
+       int ret;
+
+       temp = xhci_readl(xhci, &xhci->op_regs->command);
+       temp |= (CMD_RUN);
+       xhci_dbg(xhci, "// Turn on HC, cmd = 0x%x.\n",
+                       temp);
+       xhci_writel(xhci, temp, &xhci->op_regs->command);
+
+       /*
+        * Wait for the HCHalted Status bit to be 0 to indicate the host is
+        * running.
+        */
+       ret = handshake(xhci, &xhci->op_regs->status,
+                       STS_HALT, 0, XHCI_MAX_HALT_USEC);
+       if (ret == -ETIMEDOUT)
+               xhci_err(xhci, "Host took too long to start, "
+                               "waited %u microseconds.\n",
+                               XHCI_MAX_HALT_USEC);
+       return ret;
+}
+
 /*
  * Reset a halted HC, and set the internal HC state to HC_STATE_HALT.
  *
@@ -116,6 +143,7 @@ int xhci_reset(struct xhci_hcd *xhci)
 {
        u32 command;
        u32 state;
+       int ret;
 
        state = xhci_readl(xhci, &xhci->op_regs->status);
        if ((state & STS_HALT) == 0) {
@@ -130,7 +158,17 @@ int xhci_reset(struct xhci_hcd *xhci)
        /* XXX: Why does EHCI set this here?  Shouldn't other code do this? */
        xhci_to_hcd(xhci)->state = HC_STATE_HALT;
 
-       return handshake(xhci, &xhci->op_regs->command, CMD_RESET, 0, 250 * 1000);
+       ret = handshake(xhci, &xhci->op_regs->command,
+                       CMD_RESET, 0, 250 * 1000);
+       if (ret)
+               return ret;
+
+       xhci_dbg(xhci, "Wait for controller to be ready for doorbell rings\n");
+       /*
+        * xHCI cannot write to any doorbells or operational registers other
+        * than status until the "Controller Not Ready" flag is cleared.
+        */
+       return handshake(xhci, &xhci->op_regs->status, STS_CNR, 0, 250 * 1000);
 }
 
 
@@ -448,17 +486,20 @@ int xhci_run(struct usb_hcd *hcd)
 
        if (NUM_TEST_NOOPS > 0)
                doorbell = xhci_setup_one_noop(xhci);
+       if (xhci->quirks & XHCI_NEC_HOST)
+               xhci_queue_vendor_command(xhci, 0, 0, 0,
+                               TRB_TYPE(TRB_NEC_GET_FW));
+
+       if (xhci_start(xhci)) {
+               xhci_halt(xhci);
+               return -ENODEV;
+       }
 
-       temp = xhci_readl(xhci, &xhci->op_regs->command);
-       temp |= (CMD_RUN);
-       xhci_dbg(xhci, "// Turn on HC, cmd = 0x%x.\n",
-                       temp);
-       xhci_writel(xhci, temp, &xhci->op_regs->command);
-       /* Flush PCI posted writes */
-       temp = xhci_readl(xhci, &xhci->op_regs->command);
        xhci_dbg(xhci, "// @%p = 0x%x\n", &xhci->op_regs->command, temp);
        if (doorbell)
                (*doorbell)(xhci);
+       if (xhci->quirks & XHCI_NEC_HOST)
+               xhci_ring_cmd_db(xhci);
 
        xhci_dbg(xhci, "Finished xhci_run\n");
        return 0;
index dada2fb592616f770c0c01845438a07257d6cf7b..8b4b7d39f79cafb927523e94d95a93f59dd1b9cf 100644 (file)
@@ -925,6 +925,7 @@ union xhci_trb {
 /* TRB bit mask */
 #define        TRB_TYPE_BITMASK        (0xfc00)
 #define TRB_TYPE(p)            ((p) << 10)
+#define TRB_FIELD_TO_TYPE(p)   (((p) & TRB_TYPE_BITMASK) >> 10)
 /* TRB type IDs */
 /* bulk, interrupt, isoc scatter/gather, and control data stage */
 #define TRB_NORMAL             1
@@ -992,6 +993,14 @@ union xhci_trb {
 #define TRB_MFINDEX_WRAP       39
 /* TRB IDs 40-47 reserved, 48-63 is vendor-defined */
 
+/* Nec vendor-specific command completion event. */
+#define        TRB_NEC_CMD_COMP        48
+/* Get NEC firmware revision. */
+#define        TRB_NEC_GET_FW          49
+
+#define NEC_FW_MINOR(p)                (((p) >> 0) & 0xff)
+#define NEC_FW_MAJOR(p)                (((p) >> 8) & 0xff)
+
 /*
  * TRBS_PER_SEGMENT must be a multiple of 4,
  * since the command ring is 64-byte aligned.
@@ -1172,6 +1181,7 @@ struct xhci_hcd {
        unsigned int            quirks;
 #define        XHCI_LINK_TRB_QUIRK     (1 << 0)
 #define XHCI_RESET_EP_QUIRK    (1 << 1)
+#define XHCI_NEC_HOST          (1 << 2)
 };
 
 /* For testing purposes */
@@ -1379,6 +1389,8 @@ void xhci_set_hc_event_deq(struct xhci_hcd *xhci);
 int xhci_queue_slot_control(struct xhci_hcd *xhci, u32 trb_type, u32 slot_id);
 int xhci_queue_address_device(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr,
                u32 slot_id);
+int xhci_queue_vendor_command(struct xhci_hcd *xhci,
+               u32 field1, u32 field2, u32 field3, u32 field4);
 int xhci_queue_stop_endpoint(struct xhci_hcd *xhci, int slot_id,
                unsigned int ep_index);
 int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb,
index 3edda3ed822a5326e1072e3f49bc163af2878dae..fd35f73b572154b33b60d6415cf59ea4edde054f 100644 (file)
@@ -1239,8 +1239,7 @@ static void digi_write_bulk_callback(struct urb *urb)
 
        /* port and serial sanity check */
        if (port == NULL || (priv = usb_get_serial_port_data(port)) == NULL) {
-               dev_err(&port->dev,
-                       "%s: port or port->private is NULL, status=%d\n",
+               pr_err("%s: port or port->private is NULL, status=%d\n",
                        __func__, status);
                return;
        }
index 050211afc07ede3ded137a28b46aba79dcb01ebe..79dd1ae195e56263610c63c1d3da6e7bb71b1de5 100644 (file)
@@ -2005,6 +2005,8 @@ static void ftdi_set_termios(struct tty_struct *tty,
                                "urb failed to set to rts/cts flow control\n");
                }
 
+               /* raise DTR/RTS */
+               set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
        } else {
                /*
                 * Xon/Xoff code
@@ -2052,6 +2054,8 @@ static void ftdi_set_termios(struct tty_struct *tty,
                        }
                }
 
+               /* lower DTR/RTS */
+               clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
        }
        return;
 }
index f8424d1bfc1b279a5e4a51fc4453fb3e3f847ffb..585b7e6637405981e5019790bbdb0700109f87d0 100644 (file)
@@ -730,7 +730,6 @@ static void mos7840_bulk_in_callback(struct urb *urb)
        mos7840_port = urb->context;
        if (!mos7840_port) {
                dbg("%s", "NULL mos7840_port pointer");
-               mos7840_port->read_urb_busy = false;
                return;
        }
 
index 1e6fec487973c45a0407326f09a62f6015c39589..3d94a1471724ff620ba580808be1ceec0d868b15 100644 (file)
@@ -8,6 +8,9 @@ menu "Graphics support"
 config HAVE_FB_ATMEL
        bool
 
+config HAVE_FB_IMX
+       bool
+
 source "drivers/char/agp/Kconfig"
 
 source "drivers/gpu/vga/Kconfig"
@@ -400,9 +403,6 @@ config FB_SA1100
          If you plan to use the LCD display with your SA-1100 system, say
          Y here.
 
-config HAVE_FB_IMX
-       bool
-
 config FB_IMX
        tristate "Motorola i.MX LCD support"
        depends on FB && (HAVE_FB_IMX || ARCH_MX1 || ARCH_MX2)
index 073c9b408cf7ce1ceff2b5eb52c6f49510273291..6b93ef93cb12c08179c973e31bf97ff27eb4d56b 100644 (file)
@@ -100,6 +100,16 @@ static int fb_deferred_io_mkwrite(struct vm_area_struct *vma,
        /* protect against the workqueue changing the page list */
        mutex_lock(&fbdefio->lock);
 
+       /*
+        * We want the page to remain locked from ->page_mkwrite until
+        * the PTE is marked dirty to avoid page_mkclean() being called
+        * before the PTE is updated, which would leave the page ignored
+        * by defio.
+        * Do this by locking the page here and informing the caller
+        * about it with VM_FAULT_LOCKED.
+        */
+       lock_page(page);
+
        /* we loop through the pagelist before adding in order
        to keep the pagelist sorted */
        list_for_each_entry(cur, &fbdefio->pagelist, lru) {
@@ -121,7 +131,7 @@ page_already_added:
 
        /* come back after delay to process the deferred IO */
        schedule_delayed_work(&info->deferred_work, fbdefio->delay);
-       return 0;
+       return VM_FAULT_LOCKED;
 }
 
 static const struct vm_operations_struct fb_deferred_io_vm_ops = {
@@ -155,41 +165,25 @@ static void fb_deferred_io_work(struct work_struct *work)
 {
        struct fb_info *info = container_of(work, struct fb_info,
                                                deferred_work.work);
+       struct list_head *node, *next;
+       struct page *cur;
        struct fb_deferred_io *fbdefio = info->fbdefio;
-       struct page *page, *tmp_page;
-       struct list_head *node, *tmp_node;
-       struct list_head non_dirty;
-
-       INIT_LIST_HEAD(&non_dirty);
 
        /* here we mkclean the pages, then do all deferred IO */
        mutex_lock(&fbdefio->lock);
-       list_for_each_entry_safe(page, tmp_page, &fbdefio->pagelist, lru) {
-               lock_page(page);
-               /*
-                * The workqueue callback can be triggered after a
-                * ->page_mkwrite() call but before the PTE has been marked
-                * dirty. In this case page_mkclean() won't "rearm" the page.
-                *
-                * To avoid this, remove those "non-dirty" pages from the
-                * pagelist before calling the driver's callback, then add
-                * them back to get processed on the next work iteration.
-                * At that time, their PTEs will hopefully be dirty for real.
-                */
-               if (!page_mkclean(page))
-                       list_move_tail(&page->lru, &non_dirty);
-               unlock_page(page);
+       list_for_each_entry(cur, &fbdefio->pagelist, lru) {
+               lock_page(cur);
+               page_mkclean(cur);
+               unlock_page(cur);
        }
 
        /* driver's callback with pagelist */
        fbdefio->deferred_io(info, &fbdefio->pagelist);
 
-       /* clear the list... */
-       list_for_each_safe(node, tmp_node, &fbdefio->pagelist) {
+       /* clear the list */
+       list_for_each_safe(node, next, &fbdefio->pagelist) {
                list_del(node);
        }
-       /* ... and add back the "non-dirty" pages to the list */
-       list_splice_tail(&non_dirty, &fbdefio->pagelist);
        mutex_unlock(&fbdefio->lock);
 }
 
@@ -218,7 +212,6 @@ EXPORT_SYMBOL_GPL(fb_deferred_io_open);
 void fb_deferred_io_cleanup(struct fb_info *info)
 {
        struct fb_deferred_io *fbdefio = info->fbdefio;
-       struct list_head *node, *tmp_node;
        struct page *page;
        int i;
 
@@ -226,13 +219,6 @@ void fb_deferred_io_cleanup(struct fb_info *info)
        cancel_delayed_work(&info->deferred_work);
        flush_scheduled_work();
 
-       /*  the list may have still some non-dirty pages at this point */
-       mutex_lock(&fbdefio->lock);
-       list_for_each_safe(node, tmp_node, &fbdefio->pagelist) {
-               list_del(node);
-       }
-       mutex_unlock(&fbdefio->lock);
-
        /* clear out the mapping that we setup */
        for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) {
                page = fb_deferred_io_page(info, i);
index 49566c1687d84943d9187a12ff2d1490c8ec6ad2..b6ab27ccf214fc8c406a9ef70e91d7930af0eaec 100644 (file)
 #endif
 
 /*
- * User data (stack, data section and bss) needs to be aligned
- * for the same reasons as SLAB memory is, and to the same amount.
- * Avoid duplicating architecture specific code by using the same
- * macro as with SLAB allocation:
+ * User data (data section and bss) needs to be aligned.
+ * We pick 0x20 here because it is the max value elf2flt has always
+ * used in producing FLAT files, and because it seems to be large
+ * enough to make all the gcc alignment related tests happy.
+ */
+#define FLAT_DATA_ALIGN        (0x20)
+
+/*
+ * User data (stack) also needs to be aligned.
+ * Here we can be a bit looser than the data sections since this
+ * needs to only meet arch ABI requirements.
  */
 #ifdef ARCH_SLAB_MINALIGN
-#define FLAT_DATA_ALIGN        (ARCH_SLAB_MINALIGN)
+#define FLAT_STACK_ALIGN       (ARCH_SLAB_MINALIGN)
 #else
-#define FLAT_DATA_ALIGN        (sizeof(void *))
+#define FLAT_STACK_ALIGN       (sizeof(void *))
 #endif
 
 #define RELOC_FAILED 0xff00ff01                /* Relocation incorrect somewhere */
@@ -129,7 +136,7 @@ static unsigned long create_flat_tables(
 
        sp = (unsigned long *)p;
        sp -= (envc + argc + 2) + 1 + (flat_argvp_envp_on_stack() ? 2 : 0);
-       sp = (unsigned long *) ((unsigned long)sp & -FLAT_DATA_ALIGN);
+       sp = (unsigned long *) ((unsigned long)sp & -FLAT_STACK_ALIGN);
        argv = sp + 1 + (flat_argvp_envp_on_stack() ? 2 : 0);
        envp = argv + (argc + 1);
 
@@ -589,7 +596,7 @@ static int load_flat_file(struct linux_binprm * bprm,
                if (IS_ERR_VALUE(result)) {
                        printk("Unable to read data+bss, errno %d\n", (int)-result);
                        do_munmap(current->mm, textpos, text_len);
-                       do_munmap(current->mm, realdatastart, data_len + extra);
+                       do_munmap(current->mm, realdatastart, len);
                        ret = result;
                        goto err;
                }
@@ -876,7 +883,7 @@ static int load_flat_binary(struct linux_binprm * bprm, struct pt_regs * regs)
        stack_len = TOP_OF_ARGS - bprm->p;             /* the strings */
        stack_len += (bprm->argc + 1) * sizeof(char *); /* the argv array */
        stack_len += (bprm->envc + 1) * sizeof(char *); /* the envp array */
-       stack_len += FLAT_DATA_ALIGN - 1;  /* reserve for upcoming alignment */
+       stack_len += FLAT_STACK_ALIGN - 1;  /* reserve for upcoming alignment */
        
        res = load_flat_file(bprm, &libinfo, 0, &stack_len);
        if (IS_ERR_VALUE(res))
index f0b391c50552dc986f93afe1e4c56ce3b777a600..6490d2134ff3e73656b29b6ad5473e339870ae8d 100644 (file)
@@ -626,7 +626,7 @@ ssize_t compat_rw_copy_check_uvector(int type,
                tot_len += len;
                if (tot_len < tmp) /* maths overflow on the compat_ssize_t */
                        goto out;
-               if (!access_ok(vrfy_dir(type), buf, len)) {
+               if (!access_ok(vrfy_dir(type), compat_ptr(buf), len)) {
                        ret = -EFAULT;
                        goto out;
                }
index 126120819a0dba4aeb931094094c27d3d80f9aa0..eec3bae164d451a38b23906a283af54965074ec0 100644 (file)
@@ -12,7 +12,7 @@ struct pt_regs;
 
 extern int             register_exec_domain(struct exec_domain *);
 extern int             unregister_exec_domain(struct exec_domain *);
-extern int             __set_personality(unsigned long);
+extern int             __set_personality(unsigned int);
 
 #endif /* __KERNEL__ */
 
index a1a86a53bc735c13cdda531309aa6c8158231909..7f614ce274a9198e969d573834d8782f95b8e6a3 100644 (file)
@@ -289,7 +289,7 @@ asmlinkage long sys_capget(cap_user_header_t header,
                                cap_user_data_t dataptr);
 asmlinkage long sys_capset(cap_user_header_t header,
                                const cap_user_data_t data);
-asmlinkage long sys_personality(u_long personality);
+asmlinkage long sys_personality(unsigned int personality);
 
 asmlinkage long sys_sigpending(old_sigset_t __user *set);
 asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set,
index 92f1d99f0f172c377dee4a33a7c6587d7e562bba..383b94ba8c2002f4f07e73eedbf8adb92a6211e1 100644 (file)
 /* v1.0 and v2.0 of this standard have many things in common. For the rest
  * of the definitions, please refer to audio.h */
 
+static inline bool uac2_control_is_readable(u32 bmControls, u8 control)
+{
+       return (bmControls >> (control * 2)) & 0x1;
+}
+
+static inline bool uac2_control_is_writeable(u32 bmControls, u8 control)
+{
+       return (bmControls >> (control * 2)) & 0x2;
+}
+
 /* 4.7.2.1 Clock Source Descriptor */
 
 struct uac_clock_source_descriptor {
@@ -31,6 +41,13 @@ struct uac_clock_source_descriptor {
        __u8 iClockSource;
 } __attribute__((packed));
 
+/* bmAttribute fields */
+#define UAC_CLOCK_SOURCE_TYPE_EXT      0x0
+#define UAC_CLOCK_SOURCE_TYPE_INT_FIXED        0x1
+#define UAC_CLOCK_SOURCE_TYPE_INT_VAR  0x2
+#define UAC_CLOCK_SOURCE_TYPE_INT_PROG 0x3
+#define UAC_CLOCK_SOURCE_SYNCED_TO_SOF (1 << 2)
+
 /* 4.7.2.2 Clock Source Descriptor */
 
 struct uac_clock_selector_descriptor {
@@ -39,8 +56,20 @@ struct uac_clock_selector_descriptor {
        __u8 bDescriptorSubtype;
        __u8 bClockID;
        __u8 bNrInPins;
-       __u8 bmControls;
        __u8 baCSourceID[];
+       /* bmControls, bAssocTerminal and iClockSource omitted */
+} __attribute__((packed));
+
+/* 4.7.2.3 Clock Multiplier Descriptor */
+
+struct uac_clock_multiplier_descriptor {
+       __u8 bLength;
+       __u8 bDescriptorType;
+       __u8 bDescriptorSubtype;
+       __u8 bClockID;
+       __u8 bCSourceID;
+       __u8 bmControls;
+       __u8 iClockMultiplier;
 } __attribute__((packed));
 
 /* 4.7.2.4 Input terminal descriptor */
index 5d646c3887524febf0d39f81d2e7c4a832f875fe..c51200c715e504a951a5b18a74a599abbede08a1 100644 (file)
 #define UAC_FORMAT_TYPE                        0x02
 #define UAC_FORMAT_SPECIFIC            0x03
 
+/* A.7 Processing Unit Process Types */
+#define UAC_PROCESS_UNDEFINED          0x00
+#define UAC_PROCESS_UP_DOWNMIX         0x01
+#define UAC_PROCESS_DOLBY_PROLOGIC     0x02
+#define UAC_PROCESS_STEREO_EXTENDER    0x03
+#define UAC_PROCESS_REVERB             0x04
+#define UAC_PROCESS_CHORUS             0x05
+#define UAC_PROCESS_DYN_RANGE_COMP     0x06
+
 /* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */
 #define UAC_EP_GENERAL                 0x01
 
 
 #define UAC_GET_STAT                   0xff
 
+/* A.10 Control Selector Codes */
+
+/* A.10.1 Terminal Control Selectors */
+#define UAC_TERM_COPY_PROTECT          0x01
+
+/* A.10.2 Feature Unit Control Selectors */
+#define UAC_FU_MUTE                    0x01
+#define UAC_FU_VOLUME                  0x02
+#define UAC_FU_BASS                    0x03
+#define UAC_FU_MID                     0x04
+#define UAC_FU_TREBLE                  0x05
+#define UAC_FU_GRAPHIC_EQUALIZER       0x06
+#define UAC_FU_AUTOMATIC_GAIN          0x07
+#define UAC_FU_DELAY                   0x08
+#define UAC_FU_BASS_BOOST              0x09
+#define UAC_FU_LOUDNESS                        0x0a
+
+#define UAC_CONTROL_BIT(CS)    (1 << ((CS) - 1))
+
+/* A.10.3.1 Up/Down-mix Processing Unit Controls Selectors */
+#define UAC_UD_ENABLE                  0x01
+#define UAC_UD_MODE_SELECT             0x02
+
+/* A.10.3.2 Dolby Prologic (tm) Processing Unit Controls Selectors */
+#define UAC_DP_ENABLE                  0x01
+#define UAC_DP_MODE_SELECT             0x02
+
+/* A.10.3.3 3D Stereo Extender Processing Unit Control Selectors */
+#define UAC_3D_ENABLE                  0x01
+#define UAC_3D_SPACE                   0x02
+
+/* A.10.3.4 Reverberation Processing Unit Control Selectors */
+#define UAC_REVERB_ENABLE              0x01
+#define UAC_REVERB_LEVEL               0x02
+#define UAC_REVERB_TIME                        0x03
+#define UAC_REVERB_FEEDBACK            0x04
+
+/* A.10.3.5 Chorus Processing Unit Control Selectors */
+#define UAC_CHORUS_ENABLE              0x01
+#define UAC_CHORUS_LEVEL               0x02
+#define UAC_CHORUS_RATE                        0x03
+#define UAC_CHORUS_DEPTH               0x04
+
+/* A.10.3.6 Dynamic Range Compressor Unit Control Selectors */
+#define UAC_DCR_ENABLE                 0x01
+#define UAC_DCR_RATE                   0x02
+#define UAC_DCR_MAXAMPL                        0x03
+#define UAC_DCR_THRESHOLD              0x04
+#define UAC_DCR_ATTACK_TIME            0x05
+#define UAC_DCR_RELEASE_TIME           0x06
+
+/* A.10.4 Extension Unit Control Selectors */
+#define UAC_XU_ENABLE                  0x01
+
 /* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */
 #define UAC_MS_HEADER                  0x01
 #define UAC_MIDI_IN_JACK               0x02
@@ -244,7 +307,7 @@ struct uac_selector_unit_descriptor {
 static inline __u8 uac_selector_unit_iSelector(struct uac_selector_unit_descriptor *desc)
 {
        __u8 *raw = (__u8 *) desc;
-       return raw[9 + desc->bLength - 1];
+       return raw[desc->bLength - 1];
 }
 
 /* 4.3.2.5 Feature Unit Descriptor */
@@ -463,31 +526,6 @@ struct uac_iso_endpoint_descriptor {
 #define UAC_EP_CS_ATTR_PITCH_CONTROL   0x02
 #define UAC_EP_CS_ATTR_FILL_MAX                0x80
 
-/* A.10.2 Feature Unit Control Selectors */
-
-#define UAC_FU_CONTROL_UNDEFINED       0x00
-#define UAC_MUTE_CONTROL               0x01
-#define UAC_VOLUME_CONTROL             0x02
-#define UAC_BASS_CONTROL               0x03
-#define UAC_MID_CONTROL                        0x04
-#define UAC_TREBLE_CONTROL             0x05
-#define UAC_GRAPHIC_EQUALIZER_CONTROL  0x06
-#define UAC_AUTOMATIC_GAIN_CONTROL     0x07
-#define UAC_DELAY_CONTROL              0x08
-#define UAC_BASS_BOOST_CONTROL         0x09
-#define UAC_LOUDNESS_CONTROL           0x0a
-
-#define UAC_FU_MUTE            (1 << (UAC_MUTE_CONTROL - 1))
-#define UAC_FU_VOLUME          (1 << (UAC_VOLUME_CONTROL - 1))
-#define UAC_FU_BASS            (1 << (UAC_BASS_CONTROL - 1))
-#define UAC_FU_MID             (1 << (UAC_MID_CONTROL - 1))
-#define UAC_FU_TREBLE          (1 << (UAC_TREBLE_CONTROL - 1))
-#define UAC_FU_GRAPHIC_EQ      (1 << (UAC_GRAPHIC_EQUALIZER_CONTROL - 1))
-#define UAC_FU_AUTO_GAIN       (1 << (UAC_AUTOMATIC_GAIN_CONTROL - 1))
-#define UAC_FU_DELAY           (1 << (UAC_DELAY_CONTROL - 1))
-#define UAC_FU_BASS_BOOST      (1 << (UAC_BASS_BOOST_CONTROL - 1))
-#define UAC_FU_LOUDNESS                (1 << (UAC_LOUDNESS_CONTROL - 1))
-
 /* status word format (3.7.1.1) */
 
 #define UAC1_STATUS_TYPE_ORIG_MASK             0x0f
index 422cb19f156ef9b7a6f5ab8968ade8a618ea5d88..3ac6f5b0a64b7448aceac7407c04cf7109f7ef5d 100644 (file)
@@ -4598,7 +4598,7 @@ static int alloc_css_id(struct cgroup_subsys *ss, struct cgroup *parent,
        parent_css = parent->subsys[subsys_id];
        child_css = child->subsys[subsys_id];
        parent_id = parent_css->id;
-       depth = parent_id->depth;
+       depth = parent_id->depth + 1;
 
        child_id = get_new_cssid(ss, depth);
        if (IS_ERR(child_id))
index c35452cadded85de8e4505def877b3c5561c991f..dd62f8e714ca52d2fed7a7b14b03a6ee9a53d2f1 100644 (file)
@@ -27,7 +27,7 @@ static struct exec_domain *exec_domains = &default_exec_domain;
 static DEFINE_RWLOCK(exec_domains_lock);
 
 
-static u_long ident_map[32] = {
+static unsigned long ident_map[32] = {
        0,      1,      2,      3,      4,      5,      6,      7,
        8,      9,      10,     11,     12,     13,     14,     15,
        16,     17,     18,     19,     20,     21,     22,     23,
@@ -56,10 +56,10 @@ default_handler(int segment, struct pt_regs *regp)
 }
 
 static struct exec_domain *
-lookup_exec_domain(u_long personality)
+lookup_exec_domain(unsigned int personality)
 {
-       struct exec_domain *    ep;
-       u_long                  pers = personality(personality);
+       unsigned int pers = personality(personality);
+       struct exec_domain *ep;
 
        read_lock(&exec_domains_lock);
        for (ep = exec_domains; ep; ep = ep->next) {
@@ -70,7 +70,7 @@ lookup_exec_domain(u_long personality)
 
 #ifdef CONFIG_MODULES
        read_unlock(&exec_domains_lock);
-       request_module("personality-%ld", pers);
+       request_module("personality-%d", pers);
        read_lock(&exec_domains_lock);
 
        for (ep = exec_domains; ep; ep = ep->next) {
@@ -135,7 +135,7 @@ unregister:
 }
 
 int
-__set_personality(u_long personality)
+__set_personality(unsigned int personality)
 {
        struct exec_domain      *ep, *oep;
 
@@ -188,9 +188,9 @@ static int __init proc_execdomains_init(void)
 module_init(proc_execdomains_init);
 #endif
 
-SYSCALL_DEFINE1(personality, u_long, personality)
+SYSCALL_DEFINE1(personality, unsigned int, personality)
 {
-       u_long old = current->personality;
+       unsigned int old = current->personality;
 
        if (personality != 0xffffffff) {
                set_personality(personality);
@@ -198,7 +198,7 @@ SYSCALL_DEFINE1(personality, u_long, personality)
                        return -EINVAL;
        }
 
-       return (long)old;
+       return old;
 }
 
 
index 825e1126008f374e5d9d2650a5bb29fe2106424d..07b4f1b1a73a9b6a309a3e7fe249c813007b5d17 100644 (file)
@@ -850,7 +850,7 @@ static __init int spawn_ksoftirqd(void)
        void *cpu = (void *)(long)smp_processor_id();
        int err = cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu);
 
-       BUG_ON(err == NOTIFY_BAD);
+       BUG_ON(err != NOTIFY_OK);
        cpu_callback(&cpu_nfb, CPU_ONLINE, cpu);
        register_cpu_notifier(&cpu_nfb);
        return 0;
index 2454172a80d3c6131313007d08f91f12eb85c107..ee305c8d4e18eb038a54f0f9aea8eb2f353b1f44 100644 (file)
@@ -1717,7 +1717,7 @@ void __init init_timers(void)
 
        init_timer_stats();
 
-       BUG_ON(err == NOTIFY_BAD);
+       BUG_ON(err != NOTIFY_OK);
        register_cpu_notifier(&timers_nb);
        open_softirq(TIMER_SOFTIRQ, run_timer_softirq);
 }
index 9087d71537ddef84c011b86988e17202b007a291..250ed11d3ed2b83b8e2a87845fe97a7db096b33c 100644 (file)
@@ -113,7 +113,8 @@ static __init int test_atomic64(void)
        r += one;
        BUG_ON(v.counter != r);
 
-#if defined(CONFIG_X86) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(_ASM_GENERIC_ATOMIC64_H)
+#if defined(CONFIG_X86) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \
+    defined(CONFIG_S390) || defined(_ASM_GENERIC_ATOMIC64_H)
        INIT(onestwos);
        BUG_ON(atomic64_dec_if_positive(&v) != (onestwos - 1));
        r -= one;
index 915dceb487c11b1f1783df86908ba5e6e7317769..9c7e57cc63a34f7231b77a7d8b395d3157a34ba6 100644 (file)
@@ -1724,13 +1724,13 @@ static void shrink_zone(int priority, struct zone *zone,
  * If a zone is deemed to be full of pinned pages then just give it a light
  * scan then give up on it.
  */
-static int shrink_zones(int priority, struct zonelist *zonelist,
+static bool shrink_zones(int priority, struct zonelist *zonelist,
                                        struct scan_control *sc)
 {
        enum zone_type high_zoneidx = gfp_zone(sc->gfp_mask);
        struct zoneref *z;
        struct zone *zone;
-       int progress = 0;
+       bool all_unreclaimable = true;
 
        for_each_zone_zonelist_nodemask(zone, z, zonelist, high_zoneidx,
                                        sc->nodemask) {
@@ -1757,9 +1757,9 @@ static int shrink_zones(int priority, struct zonelist *zonelist,
                }
 
                shrink_zone(priority, zone, sc);
-               progress = 1;
+               all_unreclaimable = false;
        }
-       return progress;
+       return all_unreclaimable;
 }
 
 /*
@@ -1782,7 +1782,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
                                        struct scan_control *sc)
 {
        int priority;
-       unsigned long ret = 0;
+       bool all_unreclaimable;
        unsigned long total_scanned = 0;
        struct reclaim_state *reclaim_state = current->reclaim_state;
        unsigned long lru_pages = 0;
@@ -1813,7 +1813,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
                sc->nr_scanned = 0;
                if (!priority)
                        disable_swap_token();
-               ret = shrink_zones(priority, zonelist, sc);
+               all_unreclaimable = shrink_zones(priority, zonelist, sc);
                /*
                 * Don't shrink slabs when reclaiming memory from
                 * over limit cgroups
@@ -1826,10 +1826,8 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
                        }
                }
                total_scanned += sc->nr_scanned;
-               if (sc->nr_reclaimed >= sc->nr_to_reclaim) {
-                       ret = sc->nr_reclaimed;
+               if (sc->nr_reclaimed >= sc->nr_to_reclaim)
                        goto out;
-               }
 
                /*
                 * Try to write back as many pages as we just scanned.  This
@@ -1849,9 +1847,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
                    priority < DEF_PRIORITY - 2)
                        congestion_wait(BLK_RW_ASYNC, HZ/10);
        }
-       /* top priority shrink_zones still had more to do? don't OOM, then */
-       if (ret && scanning_global_lru(sc))
-               ret = sc->nr_reclaimed;
+
 out:
        /*
         * Now that we've scanned all the zones at this priority level, note
@@ -1877,7 +1873,14 @@ out:
        delayacct_freepages_end();
        put_mems_allowed();
 
-       return ret;
+       if (sc->nr_reclaimed)
+               return sc->nr_reclaimed;
+
+       /* top priority shrink_zones still had more to do? don't OOM, then */
+       if (scanning_global_lru(sc) && !all_unreclaimable)
+               return 1;
+
+       return 0;
 }
 
 unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
index f74c7372b3d14d3ba553cc8b904dd75585b28bd3..1db586af4f9c8189fda494d2aead7f9c6c22f954 100644 (file)
@@ -2578,6 +2578,9 @@ static int __devinit snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi)
        if (err)
                return -err;
 
+       memset(&prev_ctl, 0, sizeof(prev_ctl));
+       prev_ctl.control_type = -1;
+
        for (idx = 0; idx < 2000; idx++) {
                err = hpi_mixer_get_control_by_index(
                                ss, asihpi->h_mixer,
index dc79564fea30d2e17fef0b9abfc51b0ec636c73f..1df25cf5ce38c35f0d04fdddd43be9ea1d23c3f4 100644 (file)
@@ -1913,11 +1913,11 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev)
        if (WARN_ONCE(!azx_dev->period_bytes,
                      "hda-intel: zero azx_dev->period_bytes"))
                return -1; /* this shouldn't happen! */
-       if (wallclk <= azx_dev->period_wallclk &&
+       if (wallclk < (azx_dev->period_wallclk * 5) / 4 &&
            pos % azx_dev->period_bytes > azx_dev->period_bytes / 2)
                /* NG - it's below the first next period boundary */
                return bdl_pos_adj[chip->dev_index] ? 0 : -1;
-       azx_dev->start_wallclk = wallclk;
+       azx_dev->start_wallclk += wallclk;
        return 1; /* OK, it's fine */
 }
 
@@ -2288,6 +2288,8 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = {
        SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB),
        SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB),
        SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB),
+       SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB),
+       SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB),
        SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB),
        SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB),
        SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba A100-259", POS_FIX_LPIB),
@@ -2296,6 +2298,7 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = {
        SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB),
        SND_PCI_QUIRK(0x1565, 0x820f, "Biostar Microtech", POS_FIX_LPIB),
        SND_PCI_QUIRK(0x1565, 0x8218, "Biostar Microtech", POS_FIX_LPIB),
+       SND_PCI_QUIRK(0x1849, 0x0888, "775Dual-VSTA", POS_FIX_LPIB),
        SND_PCI_QUIRK(0x8086, 0x2503, "DG965OT AAD63733-203", POS_FIX_LPIB),
        SND_PCI_QUIRK(0x8086, 0xd601, "eMachines T5212", POS_FIX_LPIB),
        {}
index 17d4548cc353f72402693b0b39461226467a00d9..d792cddbf4c2eeb87e7e18ec812ce2c217a84b7b 100644 (file)
@@ -9476,6 +9476,7 @@ static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
        SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
        SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
        SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
+       SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
        SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
        SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
        SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
index eba9b9d257a109b3e4554581cc97f9d6fe839035..252defea93b5f2fdc4e64ad9ae4c484e2b8d9eca 100644 (file)
@@ -13,9 +13,18 @@ config SND_MXC_SOC_SSI
 
 config SND_MXC_SOC_WM1133_EV1
        tristate "Audio on the the i.MX31ADS with WM1133-EV1 fitted"
-       depends on SND_IMX_SOC && EXPERIMENTAL
+       depends on SND_IMX_SOC && MACH_MX31ADS_WM1133_EV1 && EXPERIMENTAL
        select SND_SOC_WM8350
        select SND_MXC_SOC_SSI
        help
          Enable support for audio on the i.MX31ADS with the WM1133-EV1
          PMIC board with WM8835x fitted.
+
+config SND_SOC_PHYCORE_AC97
+       tristate "SoC Audio support for Phytec phyCORE (and phyCARD) boards"
+       depends on MACH_PCM043 || MACH_PCA100
+       select SND_MXC_SOC_SSI
+       select SND_SOC_WM9712
+       help
+         Say Y if you want to add support for SoC audio on Phytec phyCORE
+         and phyCARD boards in AC97 mode
index e7ac7f493a8fa1d0874ca9992ee180679390ec69..1e362bf8834f4e5fdfc6da32cf33a96f53ef7c85 100644 (file)
@@ -11,7 +11,8 @@ snd-usb-audio-objs :=         card.o \
                        endpoint.o \
                        urb.o \
                        pcm.o \
-                       helper.o
+                       helper.o \
+                       clock.o
 
 snd-usbmidi-lib-objs := midi.o
 
index da1346bd4856893a5e2449abfe0d6cd1e6293ea5..7a8ac1d81be7fc7e1a176ad432cd43a841a9e74d 100644 (file)
@@ -236,7 +236,6 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
        }
 
        case UAC_VERSION_2: {
-               struct uac_clock_source_descriptor *cs;
                struct usb_interface_assoc_descriptor *assoc =
                        usb_ifnum_to_if(dev, ctrlif)->intf_assoc;
 
@@ -245,21 +244,6 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
                        return -EINVAL;
                }
 
-               /* FIXME: for now, we expect there is at least one clock source
-                * descriptor and we always take the first one.
-                * We should properly support devices with multiple clock sources,
-                * clock selectors and sample rate conversion units. */
-
-               cs = snd_usb_find_csint_desc(host_iface->extra, host_iface->extralen,
-                                               NULL, UAC2_CLOCK_SOURCE);
-
-               if (!cs) {
-                       snd_printk(KERN_ERR "CLOCK_SOURCE descriptor not found\n");
-                       return -EINVAL;
-               }
-
-               chip->clock_id = cs->bClockID;
-
                for (i = 0; i < assoc->bInterfaceCount; i++) {
                        int intf = assoc->bFirstInterface + i;
 
@@ -481,6 +465,8 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
                        goto __error;
        }
 
+       chip->ctrl_intf = alts;
+
        if (err > 0) {
                /* create normal USB audio interfaces */
                if (snd_usb_create_streams(chip, ifnum) < 0 ||
index ed92420c10957150f30db2891191ffe60bf4b0c3..1febf2f23754afc63eb5469450ac8da6a97f23b3 100644 (file)
@@ -25,6 +25,7 @@ struct audioformat {
        unsigned int rate_min, rate_max;        /* min/max rates */
        unsigned int nr_rates;          /* number of rate table entries */
        unsigned int *rate_table;       /* rate table */
+       unsigned char clock;            /* associated clock */
 };
 
 struct snd_usb_substream;
diff --git a/sound/usb/clock.c b/sound/usb/clock.c
new file mode 100644 (file)
index 0000000..b7aadd6
--- /dev/null
@@ -0,0 +1,311 @@
+/*
+ *   Clock domain and sample rate management functions
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ */
+
+#include <linux/bitops.h>
+#include <linux/init.h>
+#include <linux/list.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+#include <linux/usb.h>
+#include <linux/moduleparam.h>
+#include <linux/mutex.h>
+#include <linux/usb/audio.h>
+#include <linux/usb/audio-v2.h>
+
+#include <sound/core.h>
+#include <sound/info.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/initval.h>
+
+#include "usbaudio.h"
+#include "card.h"
+#include "midi.h"
+#include "mixer.h"
+#include "proc.h"
+#include "quirks.h"
+#include "endpoint.h"
+#include "helper.h"
+#include "debug.h"
+#include "pcm.h"
+#include "urb.h"
+#include "format.h"
+
+static struct uac_clock_source_descriptor *
+       snd_usb_find_clock_source(struct usb_host_interface *ctrl_iface,
+                                 int clock_id)
+{
+       struct uac_clock_source_descriptor *cs = NULL;
+
+       while ((cs = snd_usb_find_csint_desc(ctrl_iface->extra,
+                                            ctrl_iface->extralen,
+                                            cs, UAC2_CLOCK_SOURCE))) {
+               if (cs->bClockID == clock_id)
+                       return cs;
+       }
+
+       return NULL;
+}
+
+static struct uac_clock_selector_descriptor *
+       snd_usb_find_clock_selector(struct usb_host_interface *ctrl_iface,
+                                   int clock_id)
+{
+       struct uac_clock_selector_descriptor *cs = NULL;
+
+       while ((cs = snd_usb_find_csint_desc(ctrl_iface->extra,
+                                            ctrl_iface->extralen,
+                                            cs, UAC2_CLOCK_SELECTOR))) {
+               if (cs->bClockID == clock_id)
+                       return cs;
+       }
+
+       return NULL;
+}
+
+static struct uac_clock_multiplier_descriptor *
+       snd_usb_find_clock_multiplier(struct usb_host_interface *ctrl_iface,
+                                     int clock_id)
+{
+       struct uac_clock_multiplier_descriptor *cs = NULL;
+
+       while ((cs = snd_usb_find_csint_desc(ctrl_iface->extra,
+                                            ctrl_iface->extralen,
+                                            cs, UAC2_CLOCK_MULTIPLIER))) {
+               if (cs->bClockID == clock_id)
+                       return cs;
+       }
+
+       return NULL;
+}
+
+static int uac_clock_selector_get_val(struct snd_usb_audio *chip, int selector_id)
+{
+       unsigned char buf;
+       int ret;
+
+       ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0),
+                             UAC2_CS_CUR,
+                             USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
+                             UAC2_CX_CLOCK_SELECTOR << 8, selector_id << 8,
+                             &buf, sizeof(buf), 1000);
+
+       if (ret < 0)
+               return ret;
+
+       return buf;
+}
+
+static bool uac_clock_source_is_valid(struct snd_usb_audio *chip, int source_id)
+{
+       int err;
+       unsigned char data;
+       struct usb_device *dev = chip->dev;
+
+       err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
+                             USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
+                             UAC2_CS_CONTROL_CLOCK_VALID << 8, source_id << 8,
+                             &data, sizeof(data), 1000);
+
+       if (err < 0) {
+               snd_printk(KERN_WARNING "%s(): cannot get clock validity for id %d\n",
+                          __func__, source_id);
+               return err;
+       }
+
+       return !!data;
+}
+
+/* Try to find the clock source ID of a given clock entity */
+
+static int __uac_clock_find_source(struct snd_usb_audio *chip,
+                                  struct usb_host_interface *host_iface,
+                                  int entity_id, unsigned long *visited)
+{
+       struct uac_clock_source_descriptor *source;
+       struct uac_clock_selector_descriptor *selector;
+       struct uac_clock_multiplier_descriptor *multiplier;
+
+       entity_id &= 0xff;
+
+       if (test_and_set_bit(entity_id, visited)) {
+               snd_printk(KERN_WARNING
+                       "%s(): recursive clock topology detected, id %d.\n",
+                       __func__, entity_id);
+               return -EINVAL;
+       }
+
+       /* first, see if the ID we're looking for is a clock source already */
+       source = snd_usb_find_clock_source(host_iface, entity_id);
+       if (source)
+               return source->bClockID;
+
+       selector = snd_usb_find_clock_selector(host_iface, entity_id);
+       if (selector) {
+               int ret;
+
+               /* the entity ID we are looking for is a selector.
+                * find out what it currently selects */
+               ret = uac_clock_selector_get_val(chip, selector->bClockID);
+               if (ret < 0)
+                       return ret;
+
+               if (ret > selector->bNrInPins || ret < 1) {
+                       printk(KERN_ERR
+                               "%s(): selector reported illegal value, id %d, ret %d\n",
+                               __func__, selector->bClockID, ret);
+
+                       return -EINVAL;
+               }
+
+               return __uac_clock_find_source(chip, host_iface,
+                                              selector->baCSourceID[ret-1],
+                                              visited);
+       }
+
+       /* FIXME: multipliers only act as pass-thru element for now */
+       multiplier = snd_usb_find_clock_multiplier(host_iface, entity_id);
+       if (multiplier)
+               return __uac_clock_find_source(chip, host_iface,
+                                              multiplier->bCSourceID, visited);
+
+       return -EINVAL;
+}
+
+int snd_usb_clock_find_source(struct snd_usb_audio *chip,
+                             struct usb_host_interface *host_iface,
+                             int entity_id)
+{
+       DECLARE_BITMAP(visited, 256);
+       memset(visited, 0, sizeof(visited));
+       return __uac_clock_find_source(chip, host_iface, entity_id, visited);
+}
+
+static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface,
+                             struct usb_host_interface *alts,
+                             struct audioformat *fmt, int rate)
+{
+       struct usb_device *dev = chip->dev;
+       unsigned int ep;
+       unsigned char data[3];
+       int err, crate;
+
+       ep = get_endpoint(alts, 0)->bEndpointAddress;
+
+       /* if endpoint doesn't have sampling rate control, bail out */
+       if (!(fmt->attributes & UAC_EP_CS_ATTR_SAMPLE_RATE)) {
+               snd_printk(KERN_WARNING "%d:%d:%d: endpoint lacks sample rate attribute bit, cannot set.\n",
+                                  dev->devnum, iface, fmt->altsetting);
+               return 0;
+       }
+
+       data[0] = rate;
+       data[1] = rate >> 8;
+       data[2] = rate >> 16;
+       if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR,
+                                  USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT,
+                                  UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep,
+                                  data, sizeof(data), 1000)) < 0) {
+               snd_printk(KERN_ERR "%d:%d:%d: cannot set freq %d to ep %#x\n",
+                          dev->devnum, iface, fmt->altsetting, rate, ep);
+               return err;
+       }
+
+       if ((err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC_GET_CUR,
+                                  USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_IN,
+                                  UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep,
+                                  data, sizeof(data), 1000)) < 0) {
+               snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq at ep %#x\n",
+                          dev->devnum, iface, fmt->altsetting, ep);
+               return 0; /* some devices don't support reading */
+       }
+
+       crate = data[0] | (data[1] << 8) | (data[2] << 16);
+       if (crate != rate) {
+               snd_printd(KERN_WARNING "current rate %d is different from the runtime rate %d\n", crate, rate);
+               // runtime->rate = crate;
+       }
+
+       return 0;
+}
+
+static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface,
+                             struct usb_host_interface *alts,
+                             struct audioformat *fmt, int rate)
+{
+       struct usb_device *dev = chip->dev;
+       unsigned char data[4];
+       int err, crate;
+       int clock = snd_usb_clock_find_source(chip, chip->ctrl_intf, fmt->clock);
+
+       if (clock < 0)
+               return clock;
+
+       if (!uac_clock_source_is_valid(chip, clock)) {
+               snd_printk(KERN_ERR "%d:%d:%d: clock source %d is not valid, cannot use\n",
+                          dev->devnum, iface, fmt->altsetting, clock);
+               return -ENXIO;
+       }
+
+       data[0] = rate;
+       data[1] = rate >> 8;
+       data[2] = rate >> 16;
+       data[3] = rate >> 24;
+       if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC2_CS_CUR,
+                                  USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT,
+                                  UAC2_CS_CONTROL_SAM_FREQ << 8, clock << 8,
+                                  data, sizeof(data), 1000)) < 0) {
+               snd_printk(KERN_ERR "%d:%d:%d: cannot set freq %d (v2)\n",
+                          dev->devnum, iface, fmt->altsetting, rate);
+               return err;
+       }
+
+       if ((err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
+                                  USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
+                                  UAC2_CS_CONTROL_SAM_FREQ << 8, clock << 8,
+                                  data, sizeof(data), 1000)) < 0) {
+               snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2)\n",
+                          dev->devnum, iface, fmt->altsetting);
+               return err;
+       }
+
+       crate = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
+       if (crate != rate)
+               snd_printd(KERN_WARNING "current rate %d is different from the runtime rate %d\n", crate, rate);
+
+       return 0;
+}
+
+int snd_usb_init_sample_rate(struct snd_usb_audio *chip, int iface,
+                            struct usb_host_interface *alts,
+                            struct audioformat *fmt, int rate)
+{
+       struct usb_interface_descriptor *altsd = get_iface_desc(alts);
+
+       switch (altsd->bInterfaceProtocol) {
+       case UAC_VERSION_1:
+               return set_sample_rate_v1(chip, iface, alts, fmt, rate);
+
+       case UAC_VERSION_2:
+               return set_sample_rate_v2(chip, iface, alts, fmt, rate);
+       }
+
+       return -EINVAL;
+}
+
diff --git a/sound/usb/clock.h b/sound/usb/clock.h
new file mode 100644 (file)
index 0000000..beb2536
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef __USBAUDIO_CLOCK_H
+#define __USBAUDIO_CLOCK_H
+
+int snd_usb_init_sample_rate(struct snd_usb_audio *chip, int iface,
+                            struct usb_host_interface *alts,
+                            struct audioformat *fmt, int rate);
+
+int snd_usb_clock_find_source(struct snd_usb_audio *chip,
+                             struct usb_host_interface *host_iface,
+                             int entity_id);
+
+#endif /* __USBAUDIO_CLOCK_H */
index 28ee1ce3971a7fd063fdfc0f80a8f73696bb9b4b..9593b91452b97f9564989d4ab1df7a32905b4e64 100644 (file)
@@ -190,6 +190,38 @@ static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip,
        return attributes;
 }
 
+static struct uac2_input_terminal_descriptor *
+       snd_usb_find_input_terminal_descriptor(struct usb_host_interface *ctrl_iface,
+                                              int terminal_id)
+{
+       struct uac2_input_terminal_descriptor *term = NULL;
+
+       while ((term = snd_usb_find_csint_desc(ctrl_iface->extra,
+                                              ctrl_iface->extralen,
+                                              term, UAC_INPUT_TERMINAL))) {
+               if (term->bTerminalID == terminal_id)
+                       return term;
+       }
+
+       return NULL;
+}
+
+static struct uac2_output_terminal_descriptor *
+       snd_usb_find_output_terminal_descriptor(struct usb_host_interface *ctrl_iface,
+                                               int terminal_id)
+{
+       struct uac2_output_terminal_descriptor *term = NULL;
+
+       while ((term = snd_usb_find_csint_desc(ctrl_iface->extra,
+                                              ctrl_iface->extralen,
+                                              term, UAC_OUTPUT_TERMINAL))) {
+               if (term->bTerminalID == terminal_id)
+                       return term;
+       }
+
+       return NULL;
+}
+
 int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
 {
        struct usb_device *dev;
@@ -199,7 +231,7 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
        int i, altno, err, stream;
        int format = 0, num_channels = 0;
        struct audioformat *fp = NULL;
-       int num, protocol;
+       int num, protocol, clock = 0;
        struct uac_format_type_i_continuous_descriptor *fmt;
 
        dev = chip->dev;
@@ -263,6 +295,8 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
                }
 
                case UAC_VERSION_2: {
+                       struct uac2_input_terminal_descriptor *input_term;
+                       struct uac2_output_terminal_descriptor *output_term;
                        struct uac_as_header_descriptor_v2 *as =
                                snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL);
 
@@ -281,7 +315,25 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
                        num_channels = as->bNrChannels;
                        format = le32_to_cpu(as->bmFormats);
 
-                       break;
+                       /* lookup the terminal associated to this interface
+                        * to extract the clock */
+                       input_term = snd_usb_find_input_terminal_descriptor(chip->ctrl_intf,
+                                                                           as->bTerminalLink);
+                       if (input_term) {
+                               clock = input_term->bCSourceID;
+                               break;
+                       }
+
+                       output_term = snd_usb_find_output_terminal_descriptor(chip->ctrl_intf,
+                                                                             as->bTerminalLink);
+                       if (output_term) {
+                               clock = output_term->bCSourceID;
+                               break;
+                       }
+
+                       snd_printk(KERN_ERR "%d:%u:%d : bogus bTerminalLink %d\n",
+                                  dev->devnum, iface_no, altno, as->bTerminalLink);
+                       continue;
                }
 
                default:
@@ -338,6 +390,7 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
                        fp->maxpacksize = (((fp->maxpacksize >> 11) & 3) + 1)
                                        * (fp->maxpacksize & 0x7ff);
                fp->attributes = parse_uac_endpoint_attributes(chip, alts, protocol, iface_no);
+               fp->clock = clock;
 
                /* some quirks for attributes here */
 
index fe29d61de19bc80bdc0dbdc2fe209fd3fd71b21e..5367cd1e52d9dac9231077e829ca3e0869175de4 100644 (file)
@@ -29,6 +29,7 @@
 #include "quirks.h"
 #include "helper.h"
 #include "debug.h"
+#include "clock.h"
 
 /*
  * parse the audio format type I descriptor
@@ -215,15 +216,17 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,
        struct usb_device *dev = chip->dev;
        unsigned char tmp[2], *data;
        int i, nr_rates, data_size, ret = 0;
+       int clock = snd_usb_clock_find_source(chip, chip->ctrl_intf, fp->clock);
 
        /* get the number of sample rates first by only fetching 2 bytes */
        ret = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_RANGE,
                              USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
-                             UAC2_CS_CONTROL_SAM_FREQ << 8, chip->clock_id << 8,
+                             UAC2_CS_CONTROL_SAM_FREQ << 8, clock << 8,
                              tmp, sizeof(tmp), 1000);
 
        if (ret < 0) {
-               snd_printk(KERN_ERR "unable to retrieve number of sample rates\n");
+               snd_printk(KERN_ERR "%s(): unable to retrieve number of sample rates (clock %d)\n",
+                               __func__, clock);
                goto err;
        }
 
@@ -237,12 +240,13 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,
 
        /* now get the full information */
        ret = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_RANGE,
-                              USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
-                              UAC2_CS_CONTROL_SAM_FREQ << 8, chip->clock_id << 8,
-                              data, data_size, 1000);
+                             USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
+                             UAC2_CS_CONTROL_SAM_FREQ << 8, clock << 8,
+                             data, data_size, 1000);
 
        if (ret < 0) {
-               snd_printk(KERN_ERR "unable to retrieve sample rate range\n");
+               snd_printk(KERN_ERR "%s(): unable to retrieve sample rate range (clock %d)\n",
+                               __func__, clock);
                ret = -EINVAL;
                goto err_free;
        }
index 03ce971e002760e84b2d36565ee0cbfa56bebd50..a060d005e20921089309569a9e8ebb9c9115b455 100644 (file)
@@ -78,39 +78,6 @@ enum {
        USB_MIXER_U16,
 };
 
-enum {
-       USB_PROC_UPDOWN = 1,
-       USB_PROC_UPDOWN_SWITCH = 1,
-       USB_PROC_UPDOWN_MODE_SEL = 2,
-
-       USB_PROC_PROLOGIC = 2,
-       USB_PROC_PROLOGIC_SWITCH = 1,
-       USB_PROC_PROLOGIC_MODE_SEL = 2,
-
-       USB_PROC_3DENH = 3,
-       USB_PROC_3DENH_SWITCH = 1,
-       USB_PROC_3DENH_SPACE = 2,
-
-       USB_PROC_REVERB = 4,
-       USB_PROC_REVERB_SWITCH = 1,
-       USB_PROC_REVERB_LEVEL = 2,
-       USB_PROC_REVERB_TIME = 3,
-       USB_PROC_REVERB_DELAY = 4,
-
-       USB_PROC_CHORUS = 5,
-       USB_PROC_CHORUS_SWITCH = 1,
-       USB_PROC_CHORUS_LEVEL = 2,
-       USB_PROC_CHORUS_RATE = 3,
-       USB_PROC_CHORUS_DEPTH = 4,
-
-       USB_PROC_DCR = 6,
-       USB_PROC_DCR_SWITCH = 1,
-       USB_PROC_DCR_RATIO = 2,
-       USB_PROC_DCR_MAX_AMP = 3,
-       USB_PROC_DCR_THRESHOLD = 4,
-       USB_PROC_DCR_ATTACK = 5,
-       USB_PROC_DCR_RELEASE = 6,
-};
 
 /*E-mu 0202(0404) eXtension Unit(XU) control*/
 enum {
@@ -198,22 +165,24 @@ static int check_mapped_selector_name(struct mixer_build *state, int unitid,
 
 /*
  * find an audio control unit with the given unit id
- * this doesn't return any clock related units, so they need to be handled elsewhere
  */
 static void *find_audio_control_unit(struct mixer_build *state, unsigned char unit)
 {
-       unsigned char *p;
+       /* we just parse the header */
+       struct uac_feature_unit_descriptor *hdr = NULL;
 
-       p = NULL;
-       while ((p = snd_usb_find_desc(state->buffer, state->buflen, p,
-                                     USB_DT_CS_INTERFACE)) != NULL) {
-               if (p[0] >= 4 && p[2] >= UAC_INPUT_TERMINAL && p[2] <= UAC2_EXTENSION_UNIT_V2 && p[3] == unit)
-                       return p;
+       while ((hdr = snd_usb_find_desc(state->buffer, state->buflen, hdr,
+                                       USB_DT_CS_INTERFACE)) != NULL) {
+               if (hdr->bLength >= 4 &&
+                   hdr->bDescriptorSubtype >= UAC_INPUT_TERMINAL &&
+                   hdr->bDescriptorSubtype <= UAC2_SAMPLE_RATE_CONVERTER &&
+                   hdr->bUnitID == unit)
+                       return hdr;
        }
+
        return NULL;
 }
 
-
 /*
  * copy a string with the given id
  */
@@ -344,8 +313,8 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int v
                              buf, sizeof(buf), 1000);
 
        if (ret < 0) {
-               snd_printdd(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",
-                           request, validx, cval->mixer->ctrlif | (cval->id << 8), cval->val_type);
+               snd_printk(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",
+                          request, validx, cval->mixer->ctrlif | (cval->id << 8), cval->val_type);
                return ret;
        }
 
@@ -462,6 +431,16 @@ static int set_cur_mix_value(struct usb_mixer_elem_info *cval, int channel,
                             int index, int value)
 {
        int err;
+       unsigned int read_only = (channel == 0) ?
+               cval->master_readonly :
+               cval->ch_readonly & (1 << (channel - 1));
+
+       if (read_only) {
+               snd_printdd(KERN_INFO "%s(): channel %d of control %d is read_only\n",
+                           __func__, channel, cval->control);
+               return 0;
+       }
+
        err = snd_usb_mixer_set_ctl_value(cval, UAC_SET_CUR, (cval->control << 8) | channel,
                            value);
        if (err < 0)
@@ -631,6 +610,7 @@ static int get_term_name(struct mixer_build *state, struct usb_audio_term *iterm
  */
 static int check_input_term(struct mixer_build *state, int id, struct usb_audio_term *term)
 {
+       int err;
        void *p1;
 
        memset(term, 0, sizeof(*term));
@@ -651,6 +631,11 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_
                                term->channels = d->bNrChannels;
                                term->chconfig = le32_to_cpu(d->bmChannelConfig);
                                term->name = d->iTerminal;
+
+                               /* call recursively to get the clock selectors */
+                               err = check_input_term(state, d->bCSourceID, term);
+                               if (err < 0)
+                                       return err;
                        }
                        return 0;
                case UAC_FEATURE_UNIT: {
@@ -667,7 +652,8 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_
                        term->name = uac_mixer_unit_iMixer(d);
                        return 0;
                }
-               case UAC_SELECTOR_UNIT: {
+               case UAC_SELECTOR_UNIT:
+               case UAC2_CLOCK_SELECTOR: {
                        struct uac_selector_unit_descriptor *d = p1;
                        /* call recursively to retrieve the channel info */
                        if (check_input_term(state, d->baSourceID[0], term) < 0)
@@ -690,6 +676,13 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_
                        term->name = uac_processing_unit_iProcessing(d, state->mixer->protocol);
                        return 0;
                }
+               case UAC2_CLOCK_SOURCE: {
+                       struct uac_clock_source_descriptor *d = p1;
+                       term->type = d->bDescriptorSubtype << 16; /* virtual type */
+                       term->id = id;
+                       term->name = d->iClockSource;
+                       return 0;
+               }
                default:
                        return -ENODEV;
                }
@@ -709,16 +702,20 @@ struct usb_feature_control_info {
 };
 
 static struct usb_feature_control_info audio_feature_info[] = {
-       { "Mute",               USB_MIXER_INV_BOOLEAN },
-       { "Volume",             USB_MIXER_S16 },
+       { "Mute",                       USB_MIXER_INV_BOOLEAN },
+       { "Volume",                     USB_MIXER_S16 },
        { "Tone Control - Bass",        USB_MIXER_S8 },
        { "Tone Control - Mid",         USB_MIXER_S8 },
        { "Tone Control - Treble",      USB_MIXER_S8 },
        { "Graphic Equalizer",          USB_MIXER_S8 }, /* FIXME: not implemeted yet */
-       { "Auto Gain Control",  USB_MIXER_BOOLEAN },
-       { "Delay Control",      USB_MIXER_U16 },
-       { "Bass Boost",         USB_MIXER_BOOLEAN },
-       { "Loudness",           USB_MIXER_BOOLEAN },
+       { "Auto Gain Control",          USB_MIXER_BOOLEAN },
+       { "Delay Control",              USB_MIXER_U16 },
+       { "Bass Boost",                 USB_MIXER_BOOLEAN },
+       { "Loudness",                   USB_MIXER_BOOLEAN },
+       /* UAC2 specific */
+       { "Input Gain Control",         USB_MIXER_U16 },
+       { "Input Gain Pad Control",     USB_MIXER_BOOLEAN },
+       { "Phase Inverter Control",     USB_MIXER_BOOLEAN },
 };
 
 
@@ -958,7 +955,7 @@ static size_t append_ctl_name(struct snd_kcontrol *kctl, const char *str)
 static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
                              unsigned int ctl_mask, int control,
                              struct usb_audio_term *iterm, int unitid,
-                             int read_only)
+                             int readonly_mask)
 {
        struct uac_feature_unit_descriptor *desc = raw_desc;
        unsigned int len = 0;
@@ -970,7 +967,7 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
 
        control++; /* change from zero-based to 1-based value */
 
-       if (control == UAC_GRAPHIC_EQUALIZER_CONTROL) {
+       if (control == UAC_FU_GRAPHIC_EQUALIZER) {
                /* FIXME: not supported yet */
                return;
        }
@@ -989,20 +986,25 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
        cval->control = control;
        cval->cmask = ctl_mask;
        cval->val_type = audio_feature_info[control-1].type;
-       if (ctl_mask == 0)
+       if (ctl_mask == 0) {
                cval->channels = 1;     /* master channel */
-       else {
+               cval->master_readonly = readonly_mask;
+       } else {
                int i, c = 0;
                for (i = 0; i < 16; i++)
                        if (ctl_mask & (1 << i))
                                c++;
                cval->channels = c;
+               cval->ch_readonly = readonly_mask;
        }
 
        /* get min/max values */
        get_min_max(cval, 0);
 
-       if (read_only)
+       /* if all channels in the mask are marked read-only, make the control
+        * read-only. set_cur_mix_value() will check the mask again and won't
+        * issue write commands to read-only channels. */
+       if (cval->channels == readonly_mask)
                kctl = snd_ctl_new1(&usb_feature_unit_ctl_ro, cval);
        else
                kctl = snd_ctl_new1(&usb_feature_unit_ctl, cval);
@@ -1021,8 +1023,8 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
                                kctl->id.name, sizeof(kctl->id.name));
 
        switch (control) {
-       case UAC_MUTE_CONTROL:
-       case UAC_VOLUME_CONTROL:
+       case UAC_FU_MUTE:
+       case UAC_FU_VOLUME:
                /* determine the control name.  the rule is:
                 * - if a name id is given in descriptor, use it.
                 * - if the connected input can be determined, then use the name
@@ -1049,9 +1051,9 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
                                len = append_ctl_name(kctl, " Playback");
                        }
                }
-               append_ctl_name(kctl, control == UAC_MUTE_CONTROL ?
+               append_ctl_name(kctl, control == UAC_FU_MUTE ?
                                " Switch" : " Volume");
-               if (control == UAC_VOLUME_CONTROL) {
+               if (control == UAC_FU_VOLUME) {
                        kctl->tlv.c = mixer_vol_tlv;
                        kctl->vd[0].access |= 
                                SNDRV_CTL_ELEM_ACCESS_TLV_READ |
@@ -1150,7 +1152,7 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void
                snd_printk(KERN_INFO
                           "usbmixer: master volume quirk for PCM2702 chip\n");
                /* disable non-functional volume control */
-               master_bits &= ~UAC_FU_VOLUME;
+               master_bits &= ~UAC_CONTROL_BIT(UAC_FU_VOLUME);
                break;
        }
        if (channels > 0)
@@ -1188,19 +1190,22 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void
 
                        for (j = 0; j < channels; j++) {
                                unsigned int mask = snd_usb_combine_bytes(bmaControls + csize * (j+1), csize);
-                               if (mask & (1 << (i * 2))) {
+                               if (uac2_control_is_readable(mask, i)) {
                                        ch_bits |= (1 << j);
-                                       if (~mask & (1 << ((i * 2) + 1)))
+                                       if (!uac2_control_is_writeable(mask, i))
                                                ch_read_only |= (1 << j);
                                }
                        }
 
-                       /* FIXME: the whole unit is read-only if any of the channels is marked read-only */
+                       /* NOTE: build_feature_ctl() will mark the control read-only if all channels
+                        * are marked read-only in the descriptors. Otherwise, the control will be
+                        * reported as writeable, but the driver will not actually issue a write
+                        * command for read-only channels */
                        if (ch_bits & 1) /* the first channel must be set (for ease of programming) */
-                               build_feature_ctl(state, _ftr, ch_bits, i, &iterm, unitid, !!ch_read_only);
-                       if (master_bits & (1 << i * 2))
+                               build_feature_ctl(state, _ftr, ch_bits, i, &iterm, unitid, ch_read_only);
+                       if (uac2_control_is_readable(master_bits, i))
                                build_feature_ctl(state, _ftr, 0, i, &iterm, unitid,
-                                                 ~master_bits & (1 << ((i * 2) + 1)));
+                                                 !uac2_control_is_writeable(master_bits, i));
                }
        }
 
@@ -1392,51 +1397,51 @@ struct procunit_info {
 };
 
 static struct procunit_value_info updown_proc_info[] = {
-       { USB_PROC_UPDOWN_SWITCH, "Switch", USB_MIXER_BOOLEAN },
-       { USB_PROC_UPDOWN_MODE_SEL, "Mode Select", USB_MIXER_U8, 1 },
+       { UAC_UD_ENABLE, "Switch", USB_MIXER_BOOLEAN },
+       { UAC_UD_MODE_SELECT, "Mode Select", USB_MIXER_U8, 1 },
        { 0 }
 };
 static struct procunit_value_info prologic_proc_info[] = {
-       { USB_PROC_PROLOGIC_SWITCH, "Switch", USB_MIXER_BOOLEAN },
-       { USB_PROC_PROLOGIC_MODE_SEL, "Mode Select", USB_MIXER_U8, 1 },
+       { UAC_DP_ENABLE, "Switch", USB_MIXER_BOOLEAN },
+       { UAC_DP_MODE_SELECT, "Mode Select", USB_MIXER_U8, 1 },
        { 0 }
 };
 static struct procunit_value_info threed_enh_proc_info[] = {
-       { USB_PROC_3DENH_SWITCH, "Switch", USB_MIXER_BOOLEAN },
-       { USB_PROC_3DENH_SPACE, "Spaciousness", USB_MIXER_U8 },
+       { UAC_3D_ENABLE, "Switch", USB_MIXER_BOOLEAN },
+       { UAC_3D_SPACE, "Spaciousness", USB_MIXER_U8 },
        { 0 }
 };
 static struct procunit_value_info reverb_proc_info[] = {
-       { USB_PROC_REVERB_SWITCH, "Switch", USB_MIXER_BOOLEAN },
-       { USB_PROC_REVERB_LEVEL, "Level", USB_MIXER_U8 },
-       { USB_PROC_REVERB_TIME, "Time", USB_MIXER_U16 },
-       { USB_PROC_REVERB_DELAY, "Delay", USB_MIXER_U8 },
+       { UAC_REVERB_ENABLE, "Switch", USB_MIXER_BOOLEAN },
+       { UAC_REVERB_LEVEL, "Level", USB_MIXER_U8 },
+       { UAC_REVERB_TIME, "Time", USB_MIXER_U16 },
+       { UAC_REVERB_FEEDBACK, "Feedback", USB_MIXER_U8 },
        { 0 }
 };
 static struct procunit_value_info chorus_proc_info[] = {
-       { USB_PROC_CHORUS_SWITCH, "Switch", USB_MIXER_BOOLEAN },
-       { USB_PROC_CHORUS_LEVEL, "Level", USB_MIXER_U8 },
-       { USB_PROC_CHORUS_RATE, "Rate", USB_MIXER_U16 },
-       { USB_PROC_CHORUS_DEPTH, "Depth", USB_MIXER_U16 },
+       { UAC_CHORUS_ENABLE, "Switch", USB_MIXER_BOOLEAN },
+       { UAC_CHORUS_LEVEL, "Level", USB_MIXER_U8 },
+       { UAC_CHORUS_RATE, "Rate", USB_MIXER_U16 },
+       { UAC_CHORUS_DEPTH, "Depth", USB_MIXER_U16 },
        { 0 }
 };
 static struct procunit_value_info dcr_proc_info[] = {
-       { USB_PROC_DCR_SWITCH, "Switch", USB_MIXER_BOOLEAN },
-       { USB_PROC_DCR_RATIO, "Ratio", USB_MIXER_U16 },
-       { USB_PROC_DCR_MAX_AMP, "Max Amp", USB_MIXER_S16 },
-       { USB_PROC_DCR_THRESHOLD, "Threshold", USB_MIXER_S16 },
-       { USB_PROC_DCR_ATTACK, "Attack Time", USB_MIXER_U16 },
-       { USB_PROC_DCR_RELEASE, "Release Time", USB_MIXER_U16 },
+       { UAC_DCR_ENABLE, "Switch", USB_MIXER_BOOLEAN },
+       { UAC_DCR_RATE, "Ratio", USB_MIXER_U16 },
+       { UAC_DCR_MAXAMPL, "Max Amp", USB_MIXER_S16 },
+       { UAC_DCR_THRESHOLD, "Threshold", USB_MIXER_S16 },
+       { UAC_DCR_ATTACK_TIME, "Attack Time", USB_MIXER_U16 },
+       { UAC_DCR_RELEASE_TIME, "Release Time", USB_MIXER_U16 },
        { 0 }
 };
 
 static struct procunit_info procunits[] = {
-       { USB_PROC_UPDOWN, "Up Down", updown_proc_info },
-       { USB_PROC_PROLOGIC, "Dolby Prologic", prologic_proc_info },
-       { USB_PROC_3DENH, "3D Stereo Extender", threed_enh_proc_info },
-       { USB_PROC_REVERB, "Reverb", reverb_proc_info },
-       { USB_PROC_CHORUS, "Chorus", chorus_proc_info },
-       { USB_PROC_DCR, "DCR", dcr_proc_info },
+       { UAC_PROCESS_UP_DOWNMIX, "Up Down", updown_proc_info },
+       { UAC_PROCESS_DOLBY_PROLOGIC, "Dolby Prologic", prologic_proc_info },
+       { UAC_PROCESS_STEREO_EXTENDER, "3D Stereo Extender", threed_enh_proc_info },
+       { UAC_PROCESS_REVERB, "Reverb", reverb_proc_info },
+       { UAC_PROCESS_CHORUS, "Chorus", chorus_proc_info },
+       { UAC_PROCESS_DYN_RANGE_COMP, "DCR", dcr_proc_info },
        { 0 },
 };
 /*
@@ -1524,7 +1529,7 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, void *raw
                cval->channels = 1;
 
                /* get min/max values */
-               if (type == USB_PROC_UPDOWN && cval->control == USB_PROC_UPDOWN_MODE_SEL) {
+               if (type == UAC_PROCESS_UP_DOWNMIX && cval->control == UAC_UD_MODE_SELECT) {
                        __u8 *control_spec = uac_processing_unit_specific(desc, state->mixer->protocol);
                        /* FIXME: hard-coded */
                        cval->min = 1;
@@ -1619,7 +1624,7 @@ static int mixer_ctl_selector_get(struct snd_kcontrol *kcontrol, struct snd_ctl_
        struct usb_mixer_elem_info *cval = kcontrol->private_data;
        int val, err;
 
-       err = get_cur_ctl_value(cval, 0, &val);
+       err = get_cur_ctl_value(cval, cval->control << 8, &val);
        if (err < 0) {
                if (cval->mixer->ignore_ctl_error) {
                        ucontrol->value.enumerated.item[0] = 0;
@@ -1638,7 +1643,7 @@ static int mixer_ctl_selector_put(struct snd_kcontrol *kcontrol, struct snd_ctl_
        struct usb_mixer_elem_info *cval = kcontrol->private_data;
        int val, oval, err;
 
-       err = get_cur_ctl_value(cval, 0, &oval);
+       err = get_cur_ctl_value(cval, cval->control << 8, &oval);
        if (err < 0) {
                if (cval->mixer->ignore_ctl_error)
                        return 0;
@@ -1647,7 +1652,7 @@ static int mixer_ctl_selector_put(struct snd_kcontrol *kcontrol, struct snd_ctl_
        val = ucontrol->value.enumerated.item[0];
        val = get_abs_value(cval, val);
        if (val != oval) {
-               set_cur_ctl_value(cval, 0, val);
+               set_cur_ctl_value(cval, cval->control << 8, val);
                return 1;
        }
        return 0;
@@ -1729,6 +1734,11 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, void
        cval->res = 1;
        cval->initialized = 1;
 
+       if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR)
+               cval->control = UAC2_CX_CLOCK_SELECTOR;
+       else
+               cval->control = 0;
+
        namelist = kmalloc(sizeof(char *) * desc->bNrInPins, GFP_KERNEL);
        if (! namelist) {
                snd_printk(KERN_ERR "cannot malloc\n");
@@ -1778,7 +1788,9 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, void
                if (! len)
                        strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name));
 
-               if ((state->oterm.type & 0xff00) == 0x0100)
+               if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR)
+                       append_ctl_name(kctl, " Clock Source");
+               else if ((state->oterm.type & 0xff00) == 0x0100)
                        append_ctl_name(kctl, " Capture Source");
                else
                        append_ctl_name(kctl, " Playback Source");
@@ -1812,10 +1824,12 @@ static int parse_audio_unit(struct mixer_build *state, int unitid)
 
        switch (p1[2]) {
        case UAC_INPUT_TERMINAL:
+       case UAC2_CLOCK_SOURCE:
                return 0; /* NOP */
        case UAC_MIXER_UNIT:
                return parse_audio_mixer_unit(state, unitid, p1);
        case UAC_SELECTOR_UNIT:
+       case UAC2_CLOCK_SELECTOR:
                return parse_audio_selector_unit(state, unitid, p1);
        case UAC_FEATURE_UNIT:
                return parse_audio_feature_unit(state, unitid, p1);
@@ -1912,6 +1926,11 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
                        err = parse_audio_unit(&state, desc->bSourceID);
                        if (err < 0)
                                return err;
+
+                       /* for UAC2, use the same approach to also add the clock selectors */
+                       err = parse_audio_unit(&state, desc->bCSourceID);
+                       if (err < 0)
+                               return err;
                }
        }
 
index 130123854a6cfc37dc2c16cd88281222fa021300..a7cf1007fbb07478fa6a81280174aa919ac8ec4e 100644 (file)
@@ -34,6 +34,8 @@ struct usb_mixer_elem_info {
        unsigned int id;
        unsigned int control;   /* CS or ICN (high byte) */
        unsigned int cmask; /* channel mask bitmap: 0 = master */
+       unsigned int ch_readonly;
+       unsigned int master_readonly;
        int channels;
        int val_type;
        int min, max, res;
index d93fc89beba8aee1040164bccff3935f0a78524d..f1324c423835c8ade54cdb30730e7999b3cec853 100644 (file)
@@ -85,8 +85,8 @@ static struct usbmix_name_map extigy_map[] = {
        /* 16: MU (w/o controls) */
        { 17, NULL, 1 }, /* DISABLED: PU-switch (any effect?) */
        { 17, "Channel Routing", 2 },   /* PU: mode select */
-       { 18, "Tone Control - Bass", UAC_BASS_CONTROL }, /* FU */
-       { 18, "Tone Control - Treble", UAC_TREBLE_CONTROL }, /* FU */
+       { 18, "Tone Control - Bass", UAC_FU_BASS }, /* FU */
+       { 18, "Tone Control - Treble", UAC_FU_TREBLE }, /* FU */
        { 18, "Master Playback" }, /* FU; others */
        /* 19: OT speaker */
        /* 20: OT headphone */
index 056587de7be41876047296cba15a8ea96bd384a9..456829882f4061aca8e97f9d53d07f29d309bd1e 100644 (file)
@@ -31,6 +31,7 @@
 #include "urb.h"
 #include "helper.h"
 #include "pcm.h"
+#include "clock.h"
 
 /*
  * return the current pcm pointer.  just based on the hwptr_done value.
@@ -181,103 +182,6 @@ int snd_usb_init_pitch(struct snd_usb_audio *chip, int iface,
        return -EINVAL;
 }
 
-static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface,
-                             struct usb_host_interface *alts,
-                             struct audioformat *fmt, int rate)
-{
-       struct usb_device *dev = chip->dev;
-       unsigned int ep;
-       unsigned char data[3];
-       int err, crate;
-
-       ep = get_endpoint(alts, 0)->bEndpointAddress;
-       /* if endpoint doesn't have sampling rate control, bail out */
-       if (!(fmt->attributes & UAC_EP_CS_ATTR_SAMPLE_RATE)) {
-               snd_printk(KERN_WARNING "%d:%d:%d: endpoint lacks sample rate attribute bit, cannot set.\n",
-                                  dev->devnum, iface, fmt->altsetting);
-               return 0;
-       }
-
-       data[0] = rate;
-       data[1] = rate >> 8;
-       data[2] = rate >> 16;
-       if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR,
-                                  USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT,
-                                  UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep,
-                                  data, sizeof(data), 1000)) < 0) {
-               snd_printk(KERN_ERR "%d:%d:%d: cannot set freq %d to ep %#x\n",
-                          dev->devnum, iface, fmt->altsetting, rate, ep);
-               return err;
-       }
-       if ((err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC_GET_CUR,
-                                  USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_IN,
-                                  UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep,
-                                  data, sizeof(data), 1000)) < 0) {
-               snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq at ep %#x\n",
-                          dev->devnum, iface, fmt->altsetting, ep);
-               return 0; /* some devices don't support reading */
-       }
-       crate = data[0] | (data[1] << 8) | (data[2] << 16);
-       if (crate != rate) {
-               snd_printd(KERN_WARNING "current rate %d is different from the runtime rate %d\n", crate, rate);
-               // runtime->rate = crate;
-       }
-
-       return 0;
-}
-
-static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface,
-                             struct usb_host_interface *alts,
-                             struct audioformat *fmt, int rate)
-{
-       struct usb_device *dev = chip->dev;
-       unsigned char data[4];
-       int err, crate;
-
-       data[0] = rate;
-       data[1] = rate >> 8;
-       data[2] = rate >> 16;
-       data[3] = rate >> 24;
-       if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC2_CS_CUR,
-                                  USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT,
-                                  UAC2_CS_CONTROL_SAM_FREQ << 8, chip->clock_id << 8,
-                                  data, sizeof(data), 1000)) < 0) {
-               snd_printk(KERN_ERR "%d:%d:%d: cannot set freq %d (v2)\n",
-                          dev->devnum, iface, fmt->altsetting, rate);
-               return err;
-       }
-       if ((err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
-                                  USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
-                                  UAC2_CS_CONTROL_SAM_FREQ << 8, chip->clock_id << 8,
-                                  data, sizeof(data), 1000)) < 0) {
-               snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2)\n",
-                          dev->devnum, iface, fmt->altsetting);
-               return err;
-       }
-       crate = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
-       if (crate != rate)
-               snd_printd(KERN_WARNING "current rate %d is different from the runtime rate %d\n", crate, rate);
-
-       return 0;
-}
-
-int snd_usb_init_sample_rate(struct snd_usb_audio *chip, int iface,
-                            struct usb_host_interface *alts,
-                            struct audioformat *fmt, int rate)
-{
-       struct usb_interface_descriptor *altsd = get_iface_desc(alts);
-
-       switch (altsd->bInterfaceProtocol) {
-       case UAC_VERSION_1:
-               return set_sample_rate_v1(chip, iface, alts, fmt, rate);
-
-       case UAC_VERSION_2:
-               return set_sample_rate_v2(chip, iface, alts, fmt, rate);
-       }
-
-       return -EINVAL;
-}
-
 /*
  * find a matching format and set up the interface
  */
index 06ebf24d3a4d504e61840f5abca7a30a87b5d5e1..24d3319cc34d0985ace0270be5b7894a3b086c21 100644 (file)
@@ -40,9 +40,6 @@ struct snd_usb_audio {
        int num_interfaces;
        int num_suspended_intf;
 
-       /* for audio class v2 */
-       int clock_id;
-
        struct list_head pcm_list;      /* list of pcm streams */
        int pcm_devs;
 
@@ -53,6 +50,8 @@ struct snd_usb_audio {
        int setup;                      /* from the 'device_setup' module param */
        int nrpacks;                    /* from the 'nrpacks' module param */
        int async_unlink;               /* from the 'async_unlink' module param */
+
+       struct usb_host_interface *ctrl_intf;   /* the audio control interface */
 };
 
 /*