Commit 97528e89 authored by Komal Shah's avatar Komal Shah Committed by Tony Lindgren

[PATCH] ARM: OMAP: OSS AUDIO: Use struct platform driver and compilation fix

oss/omap-audio: Use struct platform_driver and compilation fix.
Used __SEMAPHORE_INIT(name,count) instead of DECLARE_MUTEX().
Signed-off-by: default avatarKomal Shah <komal_shah802003@yahoo.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 6517aa0c
...@@ -224,7 +224,7 @@ static audio_state_t aic23_state = { ...@@ -224,7 +224,7 @@ static audio_state_t aic23_state = {
.hw_remove = __exit_p(omap_aic23_remove), .hw_remove = __exit_p(omap_aic23_remove),
.hw_suspend = omap_aic23_suspend, .hw_suspend = omap_aic23_suspend,
.hw_resume = omap_aic23_resume, .hw_resume = omap_aic23_resume,
.sem = __MUTEX_INITIALIZER(aic23_state.sem), .sem = __SEMAPHORE_INIT(aic23_state.sem, 1),
}; };
/* This will be defined in the audio.h */ /* This will be defined in the audio.h */
......
...@@ -311,7 +311,7 @@ static audio_state_t tsc2101_state = { ...@@ -311,7 +311,7 @@ static audio_state_t tsc2101_state = {
.hw_remove = omap_tsc2101_remove, .hw_remove = omap_tsc2101_remove,
.hw_suspend = omap_tsc2101_suspend, .hw_suspend = omap_tsc2101_suspend,
.hw_resume = omap_tsc2101_resume, .hw_resume = omap_tsc2101_resume,
.sem = __MUTEX_INITIALIZER(tsc2101_state.sem), .sem = __SEMAPHORE_INIT(tsc2101_state.sem, 1),
}; };
/* This will be defined in the Audio.h */ /* This will be defined in the Audio.h */
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
#include <linux/soundcard.h> #include <linux/soundcard.h>
#include <linux/sysrq.h> #include <linux/sysrq.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/device.h> #include <linux/platform_device.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -106,15 +106,15 @@ static int audio_open(struct inode *inode, struct file *file); ...@@ -106,15 +106,15 @@ static int audio_open(struct inode *inode, struct file *file);
static int audio_release(struct inode *inode, struct file *file); static int audio_release(struct inode *inode, struct file *file);
static int audio_probe(struct device *dev); static int audio_probe(struct platform_device *pdev);
static int audio_remove(struct device *dev); static int audio_remove(struct platform_device *pdev);
static void audio_shutdown(struct device *dev); static void audio_shutdown(struct platform_device *pdev);
static int audio_suspend(struct device *dev, pm_message_t mesg, u32 level); static int audio_suspend(struct platform_device *pdev, pm_message_t mesg);
static int audio_resume(struct device *dev, u32 level); static int audio_resume(struct platform_device *pdev);
static void audio_free(struct device *dev); static void audio_free(struct device *dev);
...@@ -142,14 +142,15 @@ static struct file_operations omap_audio_fops = { ...@@ -142,14 +142,15 @@ static struct file_operations omap_audio_fops = {
}; };
/* Driver information */ /* Driver information */
static struct device_driver omap_audio_driver = { static struct platform_driver omap_audio_driver = {
.name = OMAP_AUDIO_NAME,
.bus = &platform_bus_type,
.probe = audio_probe, .probe = audio_probe,
.remove = audio_remove, .remove = audio_remove,
.suspend = audio_suspend, .suspend = audio_suspend,
.resume = audio_resume,
.shutdown = audio_shutdown, .shutdown = audio_shutdown,
.resume = audio_resume,
.driver = {
.name = OMAP_AUDIO_NAME,
},
}; };
/* Device Information */ /* Device Information */
...@@ -283,7 +284,7 @@ static void audio_free(struct device *dev) ...@@ -283,7 +284,7 @@ static void audio_free(struct device *dev)
* WARNING!!!! : It is expected that the codec would have registered with us by now * WARNING!!!! : It is expected that the codec would have registered with us by now
* *
*********************************************************************************/ *********************************************************************************/
static int audio_probe(struct device *dev) static int audio_probe(struct platform_device *pdev)
{ {
int ret; int ret;
FN_IN; FN_IN;
...@@ -301,7 +302,7 @@ static int audio_probe(struct device *dev) ...@@ -301,7 +302,7 @@ static int audio_probe(struct device *dev)
* audio_remove() Function to handle removal operations * audio_remove() Function to handle removal operations
* *
*********************************************************************************/ *********************************************************************************/
static int audio_remove(struct device *dev) static int audio_remove(struct platform_device *pdev)
{ {
FN_IN; FN_IN;
if (audio_state.hw_remove) { if (audio_state.hw_remove) {
...@@ -316,7 +317,7 @@ static int audio_remove(struct device *dev) ...@@ -316,7 +317,7 @@ static int audio_remove(struct device *dev)
* audio_shutdown(): Function to handle shutdown operations * audio_shutdown(): Function to handle shutdown operations
* *
*********************************************************************************/ *********************************************************************************/
static void audio_shutdown(struct device *dev) static void audio_shutdown(struct platform_device *pdev)
{ {
FN_IN; FN_IN;
if (audio_state.hw_cleanup) { if (audio_state.hw_cleanup) {
...@@ -331,16 +332,13 @@ static void audio_shutdown(struct device *dev) ...@@ -331,16 +332,13 @@ static void audio_shutdown(struct device *dev)
* audio_suspend(): Function to handle suspend operations * audio_suspend(): Function to handle suspend operations
* *
*********************************************************************************/ *********************************************************************************/
static int audio_suspend(struct device *dev, pm_message_t mesg, u32 level) static int audio_suspend(struct platform_device *pdev, pm_message_t mesg)
{ {
int ret = 0; int ret = 0;
#ifdef CONFIG_PM #ifdef CONFIG_PM
void *data = dev->driver_data; void *data = pdev->dev.driver_data;
FN_IN; FN_IN;
if (level != SUSPEND_POWER_DOWN) {
return 0;
}
if (audio_state.hw_suspend) { if (audio_state.hw_suspend) {
ret = audio_ldm_suspend(data); ret = audio_ldm_suspend(data);
if (ret == 0) if (ret == 0)
...@@ -362,16 +360,13 @@ static int audio_suspend(struct device *dev, pm_message_t mesg, u32 level) ...@@ -362,16 +360,13 @@ static int audio_suspend(struct device *dev, pm_message_t mesg, u32 level)
* audio_resume(): Function to handle resume operations * audio_resume(): Function to handle resume operations
* *
*********************************************************************************/ *********************************************************************************/
static int audio_resume(struct device *dev, u32 level) static int audio_resume(struct platform_device *dev)
{ {
int ret = 0; int ret = 0;
#ifdef CONFIG_PM #ifdef CONFIG_PM
void *data = dev->driver_data; void *data = pdev->dev.driver_data;
FN_IN; FN_IN;
if (level != RESUME_POWER_ON) {
return 0;
}
if (audio_state.hw_resume) { if (audio_state.hw_resume) {
ret = audio_ldm_resume(data); ret = audio_ldm_resume(data);
if (ret == 0) if (ret == 0)
...@@ -452,7 +447,7 @@ int audio_register_codec(audio_state_t * codec_state) ...@@ -452,7 +447,7 @@ int audio_register_codec(audio_state_t * codec_state)
goto register_out; goto register_out;
} }
ret = driver_register(&omap_audio_driver); ret = platform_driver_register(&omap_audio_driver);
if (ret != 0) { if (ret != 0) {
printk(KERN_ERR "Device Register failed =%d\n", ret); printk(KERN_ERR "Device Register failed =%d\n", ret);
ret = -ENODEV; ret = -ENODEV;
...@@ -487,7 +482,7 @@ int audio_unregister_codec(audio_state_t * codec_state) ...@@ -487,7 +482,7 @@ int audio_unregister_codec(audio_state_t * codec_state)
return -EPERM; return -EPERM;
} }
driver_unregister(&omap_audio_driver); platform_driver_unregister(&omap_audio_driver);
platform_device_unregister(&omap_audio_device); platform_device_unregister(&omap_audio_device);
memset(&audio_state, 0, sizeof(audio_state_t)); memset(&audio_state, 0, sizeof(audio_state_t));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment