From: <mar...@us...> - 2007-02-21 23:21:21
|
Revision: 865 http://svn.sourceforge.net/hackndev/?rev=865&view=rev Author: marex_z71 Date: 2007-02-21 15:21:18 -0800 (Wed, 21 Feb 2007) Log Message: ----------- l4p: sound/arm/rx3000_audio.c removed Removed Paths: ------------- linux4palm/linux/trunk/sound/arm/rx3000_audio.c Deleted: linux4palm/linux/trunk/sound/arm/rx3000_audio.c =================================================================== --- linux4palm/linux/trunk/sound/arm/rx3000_audio.c 2007-02-21 20:05:08 UTC (rev 864) +++ linux4palm/linux/trunk/sound/arm/rx3000_audio.c 2007-02-21 23:21:18 UTC (rev 865) @@ -1,352 +0,0 @@ -/* - * Copyright 2006 Roman Moravcik <rom...@gm...> - * - * Audio driver for HP iPAQ RX3000 - * - * Based on s3c24xx-tlv320aic23.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - */ - -#include <sound/driver.h> -#include <linux/module.h> -#include <linux/moduleparam.h> -#include <linux/init.h> -#include <linux/errno.h> -#include <linux/err.h> -#include <linux/ioctl.h> -#include <linux/delay.h> -#include <linux/device.h> -#include <linux/pm.h> -#include <linux/dma-mapping.h> -#include <linux/i2c.h> -#include <linux/interrupt.h> -#include <linux/irq.h> -#include <linux/clk.h> -#include <linux/platform_device.h> - -#include <asm/hardware.h> -#include <asm/dma.h> -#include <asm/io.h> - -#include <sound/driver.h> -#include <sound/core.h> -#include <sound/pcm.h> -#include <sound/initval.h> - -#include <asm/arch/regs-iis.h> -#include <asm/arch/regs-gpio.h> -#include <asm/arch/audio.h> -#include <asm/arch/rx3000-asic3.h> - -#include <linux/soc/asic3_base.h> - -#include <sound/uda1380.h> - -#include "s3c24xx-iis.h" - -extern struct platform_device s3c_device_asic3; - -static struct snd_uda1380 uda; - -struct rx3000_sound_s { - struct s3c24xx_iis_ops ops; - s3c24xx_card_t *card; - struct clk *clk; - struct device *dev; -}; - -static void snd_rx3000_audio_set_codec_power(int mode) -{ - if (mode == 1) - asic3_set_gpio_out_c(&s3c_device_asic3.dev, ASIC3_GPC7, ASIC3_GPC7); - else - asic3_set_gpio_out_c(&s3c_device_asic3.dev, ASIC3_GPC7, 0); -} - -static void snd_rx3000_audio_set_codec_reset(int mode) -{ - if (mode == 1) - asic3_set_gpio_out_a(&s3c_device_asic3.dev, ASIC3_GPA2, ASIC3_GPA2); - else - asic3_set_gpio_out_a(&s3c_device_asic3.dev, ASIC3_GPA2, 0); -} - -static void snd_rx3000_audio_set_mic_power(int mode) -{ -} - -static void snd_rx3000_audio_set_speaker_power(int mode) -{ - if (mode == 1) - asic3_set_gpio_out_a(&s3c_device_asic3.dev, ASIC3_GPA1, ASIC3_GPA1); - else - asic3_set_gpio_out_a(&s3c_device_asic3.dev, ASIC3_GPA1, 0); -} - -static inline int snd_rx3000_audio_hp_detect(void) -{ - return s3c2410_gpio_getpin(S3C2410_GPG11) ? 0 : 1; -} - -static irqreturn_t snd_rx3000_audio_hp_isr(int isr, void *data) -{ - snd_uda1380_hp_detected(&uda, snd_rx3000_audio_hp_detect()); - return IRQ_HANDLED; -} - -static void snd_rx3000_audio_hp_detection_on(void) -{ - unsigned long flags; - - set_irq_type(IRQ_EINT19, IRQ_TYPE_EDGE_BOTH); - request_irq(IRQ_EINT19, snd_rx3000_audio_hp_isr, SA_INTERRUPT | SA_SAMPLE_RANDOM, "earphone jack", NULL); - - local_irq_save(flags); - snd_uda1380_hp_detected(&uda, snd_rx3000_audio_hp_detect()); - local_irq_restore(flags); - -} - -static void snd_rx3000_audio_hp_detection_off(void) -{ - free_irq(IRQ_EINT19, NULL); -} - -static struct snd_uda1380 uda = { - .line_in_connected = 0, - .mic_connected = 1, - .hp_or_line_out = 1, - .capture_source = SND_UDA1380_CAP_SOURCE_MIC, - .power_on_chip = snd_rx3000_audio_set_codec_power, - .reset_pin = snd_rx3000_audio_set_codec_reset, - .line_out_on = snd_rx3000_audio_set_speaker_power, - .mic_on = snd_rx3000_audio_set_mic_power -}; - -int snd_rx3000_audio_startup(void *pw) -{ - uda.i2c_client.adapter = i2c_get_adapter(0); - uda.i2c_client.addr = 0x1a; - - if (snd_uda1380_activate(&uda) == 0) { - snd_rx3000_audio_hp_detection_on(); - return 0; - } else - return 1; -} - -void snd_rx3000_audio_shutdown(void *pw) -{ - snd_rx3000_audio_hp_detection_off(); - snd_uda1380_deactivate(&uda); -} - -int snd_rx3000_audio_open(void *pw, snd_pcm_substream_t *substream) -{ - snd_uda1380_open_stream(&uda, substream->stream); - return 0; -} - -int snd_rx3000_audio_close(void *pw, snd_pcm_substream_t *substream) -{ - snd_uda1380_close_stream(&uda, substream->stream); - return 0; -} -int snd_rx3000_audio_prepare(void *pw, snd_pcm_substream_t *substream, - snd_pcm_runtime_t *runtime) -{ - return 0; -} - -#ifdef CONFIG_PM -int snd_rx3000_audio_suspend(void *pw) -{ - pm_message_t state; - - snd_rx3000_audio_hp_detection_off(); - snd_uda1380_suspend(&uda, state); - - return 0; -} - -int snd_rx3000_audio_resume(void *pw) -{ - snd_uda1380_resume(&uda); - snd_rx3000_audio_hp_detection_on(); - - return 0; -} -#endif - -struct s3c24xx_iis_ops rx3000_sound_ops = { - .owner = THIS_MODULE, - .startup = snd_rx3000_audio_startup, - .shutdown = snd_rx3000_audio_shutdown, - .open = snd_rx3000_audio_open, - .close = snd_rx3000_audio_close, - .prepare = snd_rx3000_audio_prepare, -#ifdef CONFIG_PM - .suspend = snd_rx3000_audio_suspend, - .resume = snd_rx3000_audio_resume, -#endif -}; - -static void rx3000_sound_free(struct rx3000_sound_s *rx3000_sound) -{ - kfree(rx3000_sound); -} - -static struct device *audio_dev; - -static int rx3000_sound_probe(struct platform_device *pdev) -{ - audio_dev = &pdev->dev; - return 0; -} - -static int rx3000_sound_remove(struct platform_device *pdev) -{ - /* shouldn't happen */ - return 0; -} - -static struct platform_driver rx3000_sound_driver = { - .driver = { - .name = "rx3000-sound", - }, - .probe = rx3000_sound_probe, - .remove = rx3000_sound_remove, -}; - -static int rx3000_audio_codec_probe(struct platform_device *pdev) -{ - struct rx3000_sound_s *rx3000_sound; - struct device *dev = &pdev->dev; - s3c24xx_card_t *card; - int err; - - rx3000_sound = kzalloc(sizeof(struct rx3000_sound_s), GFP_KERNEL); - if (rx3000_sound == NULL) { - printk("rx3000_audio: allocate rx3000_sound failed\n"); - err = -ENOMEM; - goto exit_err; - } - memset(rx3000_sound, 0, sizeof(struct rx3000_sound_s)); - - rx3000_sound->dev = dev; - - card = s3c24xx_iis_probe(audio_dev); - if (IS_ERR(card)) { - printk("rx3000_audio: cannot probe iis device\n"); - err = PTR_ERR(card); - goto exit_err; - } - - strcpy(card->card->driver, "rx3000-sound"); - strcpy(card->card->shortname, "RX3000 Audio"); - strcpy(card->card->longname, "iPAQ RX3000 Audio [Codec Philips UDA1380]"); - - snd_card_set_dev(card->card, audio_dev); - - card->chip.ops = &rx3000_sound_ops; - card->chip.pw = &uda; - - uda.i2c_client.adapter = i2c_get_adapter(0); - uda.i2c_client.addr = 0x1a; - - if (snd_uda1380_activate(&uda) == 0) - snd_uda1380_add_mixer_controls(&uda, card->card); - snd_uda1380_deactivate(&uda); - - /* we must output cdclk */ - card->output_cdclk = 1; - - /* default configuration for IIS */ - s3c24xx_iismod_cfg(card, S3C2440_IISMOD_MPLL, 0); - s3c24xx_iismod_cfg(card, S3C2410_IISMOD_16BIT, 0x0); - s3c24xx_iismod_cfg(card, S3C2410_IISMOD_32FS, S3C2410_IISMOD_FS_MASK); - s3c24xx_iismod_cfg(card, S3C2410_IISMOD_384FS, 0x0); - - err = s3c24xx_iis_cfgclksrc(card, "cdclk"); - if (err) - goto exit_err; - - err = snd_card_register(card->card); - if (err) - goto exit_err; - - return 0; - - exit_err: - rx3000_sound_free(rx3000_sound); - rx3000_sound_remove(pdev); - - return err; -} - -static int rx3000_audio_codec_remove(struct platform_device *pdev) -{ - s3c24xx_card_t *card; - struct device *dev = &pdev->dev; - struct rx3000_sound_s *client; - - card = dev_get_drvdata(dev); - if (card != NULL) { - client = card->chip.pw; - - s3c24xx_iis_remove(dev); - rx3000_sound_free(client); - } - - return 0; -} - -#ifdef CONFIG_PM -static int rx3000_audio_codec_suspend(struct platform_device *pdev, pm_message_t state) -{ - s3c24xx_iis_suspend(audio_dev, state); - return 0; -} - -static int rx3000_audio_codec_resume(struct platform_device *pdev) -{ - s3c24xx_iis_resume(audio_dev); - return 0; -} -#endif - -struct platform_driver rx3000_sound_codecdrv = { - .driver = { - .name = "rx3000-codecdrv", - }, - .probe = rx3000_audio_codec_probe, - .remove = rx3000_audio_codec_remove, -#ifdef CONFIG_PM - .suspend = rx3000_audio_codec_suspend, - .resume = rx3000_audio_codec_resume, -#endif -}; - -static int __init rx3000_audio_init(void) -{ - request_module("i2c-s3c2410"); - platform_driver_register(&rx3000_sound_driver); - return platform_driver_register(&rx3000_sound_codecdrv); -} - -static void __exit rx3000_audio_exit(void) -{ - platform_driver_unregister(&rx3000_sound_codecdrv); - platform_driver_unregister(&rx3000_sound_driver); -} - -module_init(rx3000_audio_init); -module_exit(rx3000_audio_exit); - -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Audio driver for HP iPAQ RX3000"); -MODULE_AUTHOR("Roman Moravcik <rom...@gm...>"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |