From: Albert H. <he...@us...> - 2009-02-01 18:29:42
|
Update of /cvsroot/gc-linux/linux/sound/ppc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17186/sound/ppc Modified Files: Kconfig Makefile gcn-ai.c gcn-mic.c Log Message: Merge 2.6.28. Also: - run checkpatch against the non-broken source code - add GPIO driver fixes - implement getgeo for the special block drivers - small fixes Index: gcn-mic.c =================================================================== RCS file: /cvsroot/gc-linux/linux/sound/ppc/gcn-mic.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- gcn-mic.c 13 Sep 2008 19:42:58 -0000 1.8 +++ gcn-mic.c 1 Feb 2009 18:29:35 -0000 1.9 @@ -2,8 +2,8 @@ * sound/ppc/gcn-mic.c * * Nintendo Microphone (DOL-022) driver - * Copyright (C) 2006-2008 The GameCube Linux Team - * Copyright (C) 2006,2007,2008 Albert Herranz + * Copyright (C) 2006-2009 The GameCube Linux Team + * Copyright (C) 2006,2007,2008,2009 Albert Herranz * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -43,7 +43,7 @@ #ifdef MIC_DEBUG # define DBG(fmt, args...) \ - printk(KERN_ERR "%s: " fmt, __FUNCTION__ , ## args) + printk(KERN_ERR "%s: " fmt, __func__ , ## args) #else # define DBG(fmt, args...) #endif @@ -61,8 +61,8 @@ struct mic_device { - spinlock_t lock; - unsigned long flags; + spinlock_t lock; + unsigned long flags; u16 status; u16 control; @@ -76,8 +76,8 @@ #define MIC_CTL_PERIOD_128 (0x2<<13) #define MIC_CTL_START_SAMPLING (1<<15) - struct task_struct *io_thread; - wait_queue_head_t io_waitq; + struct task_struct *io_thread; + wait_queue_head_t io_waitq; atomic_t io_pending; struct snd_card *card; @@ -90,11 +90,11 @@ int running; #ifdef CONFIG_PROC_FS - struct proc_dir_entry *proc; + struct proc_dir_entry *proc; #endif /* CONFIG_PROC_FS */ - int refcnt; - struct exi_device *exi_device; + int refcnt; + struct exi_device *exi_device; }; @@ -106,9 +106,9 @@ struct exi_device *exi_device = dev->exi_device; u8 cmd = 0xff; - exi_dev_select(exi_device); - exi_dev_write(exi_device, &cmd, sizeof(cmd)); - exi_dev_deselect(exi_device); + exi_dev_select(exi_device); + exi_dev_write(exi_device, &cmd, sizeof(cmd)); + exi_dev_deselect(exi_device); } /* @@ -119,10 +119,10 @@ struct exi_device *exi_device = dev->exi_device; u8 cmd = 0x40; - exi_dev_select(exi_device); - exi_dev_write(exi_device, &cmd, sizeof(cmd)); - exi_dev_read(exi_device, &dev->status, sizeof(dev->status)); - exi_dev_deselect(exi_device); + exi_dev_select(exi_device); + exi_dev_write(exi_device, &cmd, sizeof(cmd)); + exi_dev_read(exi_device, &dev->status, sizeof(dev->status)); + exi_dev_deselect(exi_device); return dev->status; } @@ -141,9 +141,9 @@ DBG("control 0x80%02x%02x\n", cmd[1], cmd[2]); - exi_dev_select(exi_device); - exi_dev_write(exi_device, cmd, sizeof(cmd)); - exi_dev_deselect(exi_device); + exi_dev_select(exi_device); + exi_dev_write(exi_device, cmd, sizeof(cmd)); + exi_dev_deselect(exi_device); } @@ -155,12 +155,12 @@ struct exi_device *exi_device = dev->exi_device; u8 cmd = 0x20; - exi_dev_select(exi_device); - exi_dev_write(exi_device, &cmd, sizeof(cmd)); - exi_dev_read(exi_device, buf, len); - exi_dev_deselect(exi_device); + exi_dev_select(exi_device); + exi_dev_write(exi_device, &cmd, sizeof(cmd)); + exi_dev_read(exi_device, buf, len); + exi_dev_deselect(exi_device); -// DBG("mic cmd 0x20\n"); +/* DBG("mic cmd 0x20\n"); */ } /* @@ -181,19 +181,19 @@ { u16 control; - switch(rate) { - case 11025: - control = MIC_CTL_RATE_11025; - break; - case 22050: - control = MIC_CTL_RATE_22050; - break; - case 44100: - control = MIC_CTL_RATE_44100; - break; - default: - mic_printk(KERN_ERR, "unsupported rate: %d\n", rate); - return -EINVAL; + switch (rate) { + case 11025: + control = MIC_CTL_RATE_11025; + break; + case 22050: + control = MIC_CTL_RATE_22050; + break; + case 44100: + control = MIC_CTL_RATE_44100; + break; + default: + mic_printk(KERN_ERR, "unsupported rate: %d\n", rate); + return -EINVAL; } dev->control &= ~MIC_CTL_RATE_MASK; dev->control |= control; @@ -207,20 +207,20 @@ { u16 control; - switch(period_bytes) { - case 32: - control = MIC_CTL_PERIOD_32; - break; - case 64: - control = MIC_CTL_PERIOD_64; - break; - case 128: - control = MIC_CTL_PERIOD_128; - break; - default: - mic_printk(KERN_ERR, "unsupported period: %d bytes\n", - period_bytes); - return -EINVAL; + switch (period_bytes) { + case 32: + control = MIC_CTL_PERIOD_32; + break; + case 64: + control = MIC_CTL_PERIOD_64; + break; + case 128: + control = MIC_CTL_PERIOD_128; + break; + default: + mic_printk(KERN_ERR, "unsupported period: %d bytes\n", + period_bytes); + return -EINVAL; } dev->control &= ~MIC_CTL_PERIOD_MASK; dev->control |= control; @@ -237,7 +237,7 @@ */ static int mic_init_proc(struct mic_device *dev) { - return 0; + return 0; } /* @@ -259,24 +259,24 @@ static struct snd_pcm_hardware mic_snd_capture = { #if 0 - .info = (SNDRV_PCM_INFO_MMAP | - SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_NONINTERLEAVED | - SNDRV_PCM_INFO_BLOCK_TRANSFER | - SNDRV_PCM_INFO_MMAP_VALID), + .info = (SNDRV_PCM_INFO_MMAP | + SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_NONINTERLEAVED | + SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_MMAP_VALID), #endif - .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_NONINTERLEAVED), - .formats = SNDRV_PCM_FMTBIT_S16_BE, - .rates = SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_22050 | - SNDRV_PCM_RATE_44100, - .rate_min = 11025, - .rate_max = 44100, - .channels_min = 1, - .channels_max = 1, - .buffer_bytes_max = 32768, - .period_bytes_min = 32, - .period_bytes_max = 128, - .periods_min = 1, - .periods_max = 1024, + .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_NONINTERLEAVED), + .formats = SNDRV_PCM_FMTBIT_S16_BE, + .rates = SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_22050 | + SNDRV_PCM_RATE_44100, + .rate_min = 11025, + .rate_max = 44100, + .channels_min = 1, + .channels_max = 1, + .buffer_bytes_max = 32768, + .period_bytes_min = 32, + .period_bytes_max = 128, + .periods_min = 1, + .periods_max = 1024, }; #if 0 @@ -315,16 +315,16 @@ */ static int mic_io_thread(void *param) { - struct mic_device *dev = param; + struct mic_device *dev = param; struct snd_pcm_substream *substream; int period_bytes; u16 status; - set_user_nice(current, -20); - set_current_state(TASK_RUNNING); + set_user_nice(current, -20); + set_current_state(TASK_RUNNING); - for(;;) { - wait_event(dev->io_waitq, atomic_read(&dev->io_pending) > 0); + for (;;) { + wait_event(dev->io_waitq, atomic_read(&dev->io_pending) > 0); atomic_dec(&dev->io_pending); if (kthread_should_stop()) @@ -340,7 +340,8 @@ if (!dev->c_left) { dev->c_cur = dev->c_orig; - dev->c_left = snd_pcm_lib_buffer_bytes(substream); + dev->c_left = + snd_pcm_lib_buffer_bytes(substream); } period_bytes = snd_pcm_lib_period_bytes(substream); @@ -355,19 +356,19 @@ exi_dev_take(dev->exi_device); if (status & 0x0200) { -DBG("0x0200\n"); + DBG("0x0200\n"); mic_hey(dev); mic_enable_sampling(dev, 1); mic_control(dev); } } else { - //mic_enable_sampling(dev, 0); + /* mic_enable_sampling(dev, 0); */ dev->control = 0; mic_control(dev); } exi_dev_give(dev->exi_device); - } - return 0; + } + return 0; } /* @@ -387,55 +388,55 @@ static int hw_rule_period_bytes_by_rate(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule) { - struct snd_interval *period_bytes = + struct snd_interval *period_bytes = hw_param_interval(params, SNDRV_PCM_HW_PARAM_PERIOD_BYTES); - struct snd_interval *rate = + struct snd_interval *rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); -DBG("rate: min %d, max %d\n", rate->min, rate->max); + DBG("rate: min %d, max %d\n", rate->min, rate->max); if (rate->min == rate->max) { - if (rate->min >= 44100) { - struct snd_interval t = { - .min = 128, - .max = 128, - .integer = 1, - }; - return snd_interval_refine(period_bytes, &t); - } else if (rate->min >= 22050) { - struct snd_interval t = { - .min = 32, - .max = 32, - .integer = 1, - }; - return snd_interval_refine(period_bytes, &t); - } else { - struct snd_interval t = { - .min = 32, - .max = 32, - .integer = 1, - }; - return snd_interval_refine(period_bytes, &t); - } + if (rate->min >= 44100) { + struct snd_interval t = { + .min = 128, + .max = 128, + .integer = 1, + }; + return snd_interval_refine(period_bytes, &t); + } else if (rate->min >= 22050) { + struct snd_interval t = { + .min = 32, + .max = 32, + .integer = 1, + }; + return snd_interval_refine(period_bytes, &t); + } else { + struct snd_interval t = { + .min = 32, + .max = 32, + .integer = 1, + }; + return snd_interval_refine(period_bytes, &t); + } } return 0; } static int mic_snd_pcm_capture_open(struct snd_pcm_substream *substream) { - struct mic_device *dev = snd_pcm_substream_chip(substream); - struct snd_pcm_runtime *runtime = substream->runtime; + struct mic_device *dev = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; unsigned long flags; int retval; -DBG("enter\n"); + DBG("enter\n"); spin_lock_irqsave(&dev->lock, flags); dev->running = 0; - dev->c_substream = substream; + dev->c_substream = substream; spin_unlock_irqrestore(&dev->lock, flags); - runtime->hw = mic_snd_capture; + runtime->hw = mic_snd_capture; #if 0 /* only 32, 64 and 128 */ @@ -450,24 +451,24 @@ hw_rule_period_bytes_by_rate, 0, SNDRV_PCM_HW_PARAM_RATE, -1); - /* align to 32 bytes */ + /* align to 32 bytes */ retval = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 32); - return retval; + return retval; } static int mic_snd_pcm_capture_close(struct snd_pcm_substream *substream) { - struct mic_device *dev = snd_pcm_substream_chip(substream); + struct mic_device *dev = snd_pcm_substream_chip(substream); unsigned long flags; DBG("enter\n"); spin_lock_irqsave(&dev->lock, flags); dev->running = 0; - dev->c_substream = NULL; + dev->c_substream = NULL; spin_unlock_irqrestore(&dev->lock, flags); mic_wakeup_io_thread(dev); @@ -495,7 +496,7 @@ static int mic_snd_pcm_prepare(struct snd_pcm_substream *substream) { struct mic_device *dev = snd_pcm_substream_chip(substream); - struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_pcm_runtime *runtime = substream->runtime; unsigned long flags; int retval; @@ -528,27 +529,28 @@ { struct mic_device *dev = snd_pcm_substream_chip(substream); - switch(cmd) { - case SNDRV_PCM_TRIGGER_START: - if (!dev->running) { -DBG("trigger start\n"); - dev->running = 1; - exi_dev_take(dev->exi_device); - mic_hey(dev); - mic_enable_sampling(dev, 1); - mic_control(dev); - exi_dev_give(dev->exi_device); - } - break; - case SNDRV_PCM_TRIGGER_STOP: -DBG("trigger stop\n"); - dev->running = 0; - break; + switch (cmd) { + case SNDRV_PCM_TRIGGER_START: + if (!dev->running) { + DBG("trigger start\n"); + dev->running = 1; + exi_dev_take(dev->exi_device); + mic_hey(dev); + mic_enable_sampling(dev, 1); + mic_control(dev); + exi_dev_give(dev->exi_device); + } + break; + case SNDRV_PCM_TRIGGER_STOP: + DBG("trigger stop\n"); + dev->running = 0; + break; } return 0; } -static snd_pcm_uframes_t mic_snd_pcm_pointer(struct snd_pcm_substream *substream) +static snd_pcm_uframes_t +mic_snd_pcm_pointer(struct snd_pcm_substream *substream) { struct mic_device *dev = snd_pcm_substream_chip(substream); size_t ptr; @@ -594,8 +596,8 @@ &mic_snd_pcm_capture_ops); snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, - snd_dma_continuous_data - (GFP_KERNEL), + snd_dma_continuous_data + (GFP_KERNEL), 32*1024, 32*1024); return 0; } @@ -747,7 +749,7 @@ if (exi_device->eid.id != MIC_EXI_ID) return -ENODEV; - DBG("Microphone inserted\n"); + DBG("Microphone inserted\n"); dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (!dev) @@ -774,7 +776,7 @@ { struct mic_device *dev = exi_get_drvdata(exi_device); - DBG("Microphone removed\n"); + DBG("Microphone removed\n"); if (dev) { mic_exit(dev); Index: Makefile =================================================================== RCS file: /cvsroot/gc-linux/linux/sound/ppc/Makefile,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Makefile 24 Feb 2008 18:05:35 -0000 1.8 +++ Makefile 1 Feb 2009 18:29:35 -0000 1.9 @@ -11,4 +11,3 @@ obj-$(CONFIG_SND_PS3) += snd_ps3.o obj-$(CONFIG_SND_GAMECUBE) += snd-gcn.o obj-$(CONFIG_SND_GAMECUBE_MIC) += gcn-mic.o - Index: gcn-ai.c =================================================================== RCS file: /cvsroot/gc-linux/linux/sound/ppc/gcn-ai.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- gcn-ai.c 13 Sep 2008 19:42:58 -0000 1.13 +++ gcn-ai.c 1 Feb 2009 18:29:35 -0000 1.14 @@ -2,8 +2,8 @@ * sound/ppc/gcn-ai.c * * Nintendo GameCube/Wii Audio Interface (AI) driver - * Copyright (C) 2004-2008 The GameCube Linux Team - * Copyright (C) 2007,2008 Albert Herranz + * Copyright (C) 2004-2009 The GameCube Linux Team + * Copyright (C) 2007,2008,2009 Albert Herranz * * Based on work from mist, kirin, groepaz, Steve_-, isobel and others. * @@ -20,7 +20,7 @@ #include <linux/of_platform.h> #include <linux/interrupt.h> #include <linux/dma-mapping.h> -#include <asm/io.h> +#include <linux/io.h> #include <sound/core.h> #include <sound/pcm.h> #define SNDRV_GET_ID @@ -38,7 +38,7 @@ static char ai_driver_version[] = "1.0i"; #define drv_printk(level, format, arg...) \ - printk(level DRV_MODULE_NAME ": " format , ## arg) + printk(level DRV_MODULE_NAME ": " format , ## arg) /* @@ -87,13 +87,13 @@ struct snd_pcm_substream *playback_substream; struct snd_pcm_substream *capture_substream; - volatile int start_play; - volatile int stop_play; + int start_play; + int stop_play; dma_addr_t dma_addr; size_t period_size; int nperiods; - volatile int cur_period; + int cur_period; void __iomem *dsp_base; void __iomem *ai_base; @@ -175,7 +175,7 @@ static int index = SNDRV_DEFAULT_IDX1; /* index 0-MAX */ static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ -static struct snd_gcn *gcn_audio = NULL; +static struct snd_gcn *gcn_audio; static struct snd_pcm_hardware snd_gcn_playback = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | @@ -219,7 +219,7 @@ } static int snd_gcn_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params * hw_params) + struct snd_pcm_hw_params *hw_params) { return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); @@ -322,9 +322,9 @@ /* load next sample if we are not stopping */ if (!chip->stop_play) { - if (chip->cur_period < (chip->nperiods - 1)) { + if (chip->cur_period < (chip->nperiods - 1)) chip->cur_period++; - } else + else chip->cur_period = 0; addr = chip->playback_substream->runtime->dma_area @@ -349,7 +349,7 @@ csr &= ~(AI_CSR_PIINT | AI_CSR_ARINT | AI_CSR_DSPINT); out_be16(chip->dsp_base + AI_DSP_CSR, csr); local_irq_restore(flags); - + return IRQ_HANDLED; } @@ -365,7 +365,7 @@ .pointer = snd_gcn_pointer, }; -static int __devinit snd_gcn_new_pcm(struct snd_gcn * chip) +static int __devinit snd_gcn_new_pcm(struct snd_gcn *chip) { struct snd_pcm *pcm; int retval; @@ -586,7 +586,7 @@ static void __exit ai_exit_module(void) { - of_unregister_platform_driver(&ai_of_driver); + of_unregister_platform_driver(&ai_of_driver); } module_init(ai_init_module); Index: Kconfig =================================================================== RCS file: /cvsroot/gc-linux/linux/sound/ppc/Kconfig,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- Kconfig 15 Nov 2008 20:10:15 -0000 1.16 +++ Kconfig 1 Feb 2009 18:29:35 -0000 1.17 @@ -53,7 +53,7 @@ depends on SND && GAMECUBE_COMMON help Say Y here to include support for audio on the Nintendo GameCube/Wii. - + To compile this driver as a module, choose M here: the module will be called snd-gcn. @@ -63,7 +63,7 @@ help If you say yes to this option, support will be included for the Nintendo GameCube Microphone (DOL-022). - + If in doubt, say N here. endif # SND_PPC |