All pastes #2277 Raw Edit

Rroetsytootsy

public text v1 · immutable
#2277 ·published 2004-11-23 21:09 UTC
rendered paste body
/*
 * Hardware audio controls for HP iPAQ h2200
 *
 * Copyright © 2004 Michael Opdenacker <http://opdenacker.org>
 * Modiefied 2004-11-21 by Jelle Kalf for H4xxx operations
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file COPYING in the main directory of this archive for
 * more details.
 *
 */

#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/pm.h>
#include <sound/uda1380.h>
#include <asm/arch/h4000-gpio.h>
#include <asm/hardware.h>

/* It's up to the <machine>_audio drive to initialize 
 * the uda1380_device_controls variable, as it's needed
 * to initialize the uda1380 module.
 * 
 * I hope it's not an issue to have 2 different _audio
 * modules defining the same uda1380_device_controls symbol,
 * provided only one such module is used at a time.
 * Let me know if there are better solutions!
 */

uda1380_device_controls_t uda1380_device_controls;

static void h4000_audio_set_codec_power (int mode)
{
        SET_H4000_GPIO(AC_SDATA_IN, mode);
}

static void h4000_audio_set_codec_reset (int mode)
{
        SET_H4000_GPIO(CODEC_RST, mode);
}

static void h4000_audio_set_speaker_power (int mode)
{
        SET_H4000_GPIO(AC_SDATA_OUT, mode);
}

static void h4000_audio_set_tda_mode (int mode)
{
        SET_H4000_GPIO(AC_AUDIO_CLK, mode);
}

static int __init h4000_audio_init(void)
{
        uda1380_device_controls.set_codec_power = h4000_audio_set_codec_power;
        uda1380_device_controls.set_codec_reset = h4000_audio_set_codec_reset;
        uda1380_device_controls.set_speaker_power = h4000_audio_set_speaker_power;
        uda1380_device_controls.set_tda_mode = h4000_audio_set_tda_mode;
        return (0);
}

static void __exit h4000_audio_exit(void)
{
        uda1380_device_controls.set_codec_power = NULL;
        uda1380_device_controls.set_codec_reset = NULL;
        uda1380_device_controls.set_speaker_power = NULL;
        uda1380_device_controls.set_tda_mode = NULL;
}


module_init(h4000_audio_init);
module_exit(h4000_audio_exit);

EXPORT_SYMBOL(uda1380_device_controls);
MODULE_AUTHOR("Michael Opdenacker <http://opdenacker.org/>");
MODULE_DESCRIPTION("Hardware audio controls for HP iPAQ 4xxx");
MODULE_LICENSE("GPL");