[Armadeus-commitlog] armadeus branch, master, updated. release-3.2-19-g6bcecb8
Brought to you by:
sszy
|
From: Julien B a. A. <ar...@us...> - 2009-12-07 08:12:13
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "armadeus".
The branch, master has been updated
via 6bcecb85efaad9ca0a7fb4a4e3221066d06960f7 (commit)
via dc9bb756e5b4f1a9d20a4aec1dcd21d6c18cdda6 (commit)
via 95c6f562ac61449ca2e3e0f87a8669f91780cf25 (commit)
from f8475442e84c24370ffc8b3155ca667658cdf070 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 6bcecb85efaad9ca0a7fb4a4e3221066d06960f7
Author: Julien Boibessot <jul...@ar...>
Date: Mon Dec 7 09:11:47 2009 +0100
Indentation
commit dc9bb756e5b4f1a9d20a4aec1dcd21d6c18cdda6
Merge: 95c6f562ac61449ca2e3e0f87a8669f91780cf25 f8475442e84c24370ffc8b3155ca667658cdf070
Author: Julien Boibessot <jul...@ar...>
Date: Mon Dec 7 08:32:15 2009 +0100
Merge branch 'master' of ssh://artemys@armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
commit 95c6f562ac61449ca2e3e0f87a8669f91780cf25
Author: Julien Boibessot <jul...@ar...>
Date: Thu Dec 3 22:05:02 2009 +0100
[LINUX] Add custom driver for MAX9768 audio amplifier
-----------------------------------------------------------------------
Summary of changes:
.../armadeus/apf27/apf27-linux-2.6.29.config | 3 +-
.../armadeus/apf9328/apf9328-linux-2.6.29.config | 5 +-
scripts/quiltify.sh | 10 +-
target/linux/modules/Kconfig | 2 +
target/linux/modules/Makefile | 2 +-
target/linux/modules/max9768/Kconfig | 10 +
target/linux/modules/{max1027 => max9768}/Makefile | 4 +-
target/linux/modules/max9768/max9768.c | 288 ++++++++++++++++++++
.../definitions.h => modules/max9768/max9768.h} | 29 +-
9 files changed, 328 insertions(+), 25 deletions(-)
create mode 100644 target/linux/modules/max9768/Kconfig
copy target/linux/modules/{max1027 => max9768}/Makefile (82%)
mode change 100755 => 100644
create mode 100644 target/linux/modules/max9768/max9768.c
copy target/linux/{debug/imxregs/definitions.h => modules/max9768/max9768.h} (60%)
diff --git a/buildroot/target/device/armadeus/apf27/apf27-linux-2.6.29.config b/buildroot/target/device/armadeus/apf27/apf27-linux-2.6.29.config
index f0e9e44..4ce03df 100644
--- a/buildroot/target/device/armadeus/apf27/apf27-linux-2.6.29.config
+++ b/buildroot/target/device/armadeus/apf27/apf27-linux-2.6.29.config
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.29.6
-# Tue Oct 20 13:32:01 2009
+# Thu Dec 3 21:58:38 2009
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -1395,6 +1395,7 @@ CONFIG_ARMADEUS_DRIVERS=y
CONFIG_ARMADEUS_GPIO_DRIVER=m
# CONFIG_ARMADEUS_KEYPAD_DRIVER is not set
CONFIG_ARMADEUS_MAX1027=m
+# CONFIG_ARMADEUS_MAX9768 is not set
#
# FPGA related
diff --git a/buildroot/target/device/armadeus/apf9328/apf9328-linux-2.6.29.config b/buildroot/target/device/armadeus/apf9328/apf9328-linux-2.6.29.config
index 210606a..ae18428 100644
--- a/buildroot/target/device/armadeus/apf9328/apf9328-linux-2.6.29.config
+++ b/buildroot/target/device/armadeus/apf9328/apf9328-linux-2.6.29.config
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.29.4
-# Tue Aug 18 11:52:19 2009
+# Linux kernel version: 2.6.29.6
+# Thu Dec 3 21:58:38 2009
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -1191,6 +1191,7 @@ CONFIG_ARMADEUS_GPIO_DRIVER=m
CONFIG_ARMADEUS_PPDEV_DRIVER=m
CONFIG_ARMADEUS_KEYPAD_DRIVER=m
CONFIG_ARMADEUS_MAX1027=m
+# CONFIG_ARMADEUS_MAX9768 is not set
#
# FPGA related
diff --git a/scripts/quiltify.sh b/scripts/quiltify.sh
index f61d9a8..260c85b 100755
--- a/scripts/quiltify.sh
+++ b/scripts/quiltify.sh
@@ -26,16 +26,16 @@ make shell_env
. armadeus_env.sh
if [ "$1" != "export" ]; then
- ask_user "What do you want to quiltify today ? ;-)" "Linux (default)" "Buildroot"
+ ask_user "What do you want to quiltify today ? ;-)" "Linux (default)" "Buildroot"
fi
if [ "$1" == "export" ]; then
- ask_user "What kind of quilt patches do you want to export ?" "Linux (default)" "Buildroot"
+ ask_user "What kind of quilt patches do you want to export ?" "Linux (default)" "Buildroot"
fi
if [ "$answer" == "2" ]; then
- QUILT_TARGET_NAME="Buildroot"
+ QUILT_TARGET_NAME="Buildroot"
QUILT_MAKEFILE_TARGET="buildroot-unpacked"
- QUILT_TARGET_DIR=$ARMADEUS_BUILDROOT_DIR
+ QUILT_TARGET_DIR=$ARMADEUS_BUILDROOT_DIR
QUILT_TARGET_PATCH_DIR=$ARMADEUS_BUILDROOT_DIR/../patches/buildroot
else
QUILT_TARGET_NAME="Linux kernel"
@@ -45,7 +45,7 @@ else
fi
if [ "$1" != "export" ]; then
- echo -e "\nThis script is going to rebuilt a quiltified "$QUILT_TARGET_NAME" in the current view..."
+ echo -e "\nThis script is going to rebuilt a quiltified "$QUILT_TARGET_NAME" in the current view..."
fi
if [ "$1" == "export" ]; then
diff --git a/target/linux/modules/Kconfig b/target/linux/modules/Kconfig
index c0f24f4..6262ced 100644
--- a/target/linux/modules/Kconfig
+++ b/target/linux/modules/Kconfig
@@ -21,6 +21,8 @@ source "drivers/armadeus/imxlkeypad/Kconfig"
source "drivers/armadeus/max1027/Kconfig"
+source "drivers/armadeus/max9768/Kconfig"
+
comment "FPGA related"
depends on ARMADEUS_DRIVERS
diff --git a/target/linux/modules/Makefile b/target/linux/modules/Makefile
index 9153be7..60e24aa 100755
--- a/target/linux/modules/Makefile
+++ b/target/linux/modules/Makefile
@@ -9,7 +9,7 @@ ifneq ($(KERNELRELEASE),)
# Part executed when called from kernel build system:
obj-$(CONFIG_ARMADEUS_DRIVERS) += gpio/ pwm/ backlight/ isp1761/ \
- imxlkeypad/ fpga/ max1027/
+ imxlkeypad/ fpga/ max1027/ max9768/
else
diff --git a/target/linux/modules/max9768/Kconfig b/target/linux/modules/max9768/Kconfig
new file mode 100644
index 0000000..f130517
--- /dev/null
+++ b/target/linux/modules/max9768/Kconfig
@@ -0,0 +1,10 @@
+#
+#
+
+config ARMADEUS_MAX9768
+ tristate "MAX9768 Audio amplifier"
+ default n
+ depends on ARMADEUS_DRIVERS
+ ---help---
+ Custom Armadeus driver for MAX9768 Audio amplifier driver.
+ (To wait until we are Asoc compatible)
diff --git a/target/linux/modules/max1027/Makefile b/target/linux/modules/max9768/Makefile
old mode 100755
new mode 100644
similarity index 82%
copy from target/linux/modules/max1027/Makefile
copy to target/linux/modules/max9768/Makefile
index aef647a..d60e4f4
--- a/target/linux/modules/max1027/Makefile
+++ b/target/linux/modules/max9768/Makefile
@@ -1,11 +1,11 @@
#
-# Makefile for the Armadeus Max1027
+# Makefile for the Armadeus MAX9768 custom driver
#
# Part executed when called from kernel build system:
ifneq ($(KERNELRELEASE),)
-obj-$(CONFIG_ARMADEUS_MAX1027) += max1027.o
+obj-$(CONFIG_ARMADEUS_MAX9768) += max9768.o
# Part executed when called from standard make in this directory:
# (preferably use Makefile in parent directory)
diff --git a/target/linux/modules/max9768/max9768.c b/target/linux/modules/max9768/max9768.c
new file mode 100644
index 0000000..2bc3160
--- /dev/null
+++ b/target/linux/modules/max9768/max9768.c
@@ -0,0 +1,288 @@
+/*
+ * Max9768 audio amplifier driver
+ *
+ * Copyright (C) 2009 Armadeus Project / Armadeus Systems
+ * Author: Nicolas Colombain
+ *
+ * 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/param.h>
+#include <linux/platform_device.h>
+#include <linux/i2c.h>
+#include <linux/sysfs.h>
+#include <mach/gpio.h>
+#include <linux/err.h>
+
+#include "max9768.h"
+
+#define DRIVER_VERSION "0.1"
+#define DRIVER_NAME "max9768"
+#define MAX9768_VOLUME_MASK 0x3F
+
+
+struct max9768 {
+ struct i2c_client *client;
+ int mute_pin;
+ int shdn_pin;
+ int current_volume;
+ int shdn_state;
+ int mute_state;
+};
+
+static void max9768_shutdown(struct max9768 *max9768, int shutdown)
+{
+ if (max9768->shdn_pin) {
+ if (shutdown)
+ gpio_set_value(max9768->shdn_pin, 0);
+ else
+ gpio_set_value(max9768->shdn_pin, 1);
+ }
+ max9768->shdn_state = shutdown;
+}
+
+static void max9768_mute(struct max9768 *max9768, int mute)
+{
+ if (max9768->mute_pin) {
+ gpio_set_value(max9768->mute_pin, mute);
+ }
+ max9768->mute_state = mute;
+}
+
+static void max9768_send( struct i2c_client *client, int value )
+{
+ char msg = value & 0xff;
+
+ i2c_master_send(client, &msg, 1);
+}
+
+/* sysfs hook functions */
+
+static ssize_t max9768_set_volume(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t count)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ char msg;
+
+ msg = (simple_strtol(buf, NULL, 10)) & MAX9768_VOLUME_MASK;
+ pr_debug("%s: 0x%02x\n", __FUNCTION__, msg);
+ max9768_send( client, msg);
+
+ return count;
+}
+
+static ssize_t max9768_set_mute(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t count)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct max9768 *max9768 = i2c_get_clientdata(client);
+
+ if (simple_strtol(buf, NULL, 10) == 0)
+ max9768_mute(max9768, 0);
+ else
+ max9768_mute(max9768, 1);
+
+ return count;
+}
+
+static ssize_t max9768_set_shutdown(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t count)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct max9768 *max9768 = i2c_get_clientdata(client);
+
+ if (simple_strtol(buf, NULL, 10) == 0)
+ max9768_shutdown(max9768, 0);
+ else
+ max9768_shutdown(max9768, 1);
+
+ return count;
+}
+
+static DEVICE_ATTR(shutdown, S_IWUSR, NULL, max9768_set_shutdown);
+static DEVICE_ATTR(mute, S_IWUSR, NULL, max9768_set_mute);
+static DEVICE_ATTR(volume, S_IWUSR, NULL, max9768_set_volume);
+
+static int max9768_create_sys_entries(struct i2c_client *client)
+{
+ int status = 0;
+
+ if ((status = device_create_file(&client->dev, &dev_attr_volume))) {
+ printk(KERN_WARNING "Unable to create sysfs attribute for max9768 volume register\n");
+ goto exit;
+ }
+ if ((status = device_create_file(&client->dev, &dev_attr_mute))) {
+ printk(KERN_WARNING "Unable to create sysfs attribute for max9768 mute register\n");
+ goto exit;
+ }
+ if ((status = device_create_file(&client->dev, &dev_attr_shutdown))) {
+ printk(KERN_WARNING "Unable to create sysfs attribute for max9768 shutdown register\n");
+ goto exit;
+ }
+
+exit:
+ return status;
+}
+
+static void max9768_remove_sys_entries(struct i2c_client *client)
+{
+ device_remove_file(&client->dev, &dev_attr_volume);
+ device_remove_file(&client->dev, &dev_attr_mute);
+ device_remove_file(&client->dev, &dev_attr_shutdown);
+}
+
+
+static int max9768_probe(struct i2c_client *client,
+ const struct i2c_device_id *id)
+{
+ struct max9768 *max9768;
+ struct max9768_platform_data *platform_data;
+ int result;
+
+ platform_data = (struct max9768_platform_data *)(client->dev.platform_data);
+ if (!platform_data) {
+ dev_err(&client->dev, "can't get the platform data for max9768\n");
+ return -EINVAL;
+ }
+
+ max9768 = kzalloc(sizeof(struct max9768), GFP_KERNEL);
+ if (!max9768) {
+ dev_err(&client->dev, "can't allocate memory\n");
+ return -ENOMEM;
+ }
+
+ max9768->client = client;
+ i2c_set_clientdata(client, max9768);
+ dev_set_drvdata(&client->dev, max9768);
+
+ /* Create /sys entries */
+ result = max9768_create_sys_entries(client);
+ if (result)
+ goto out_free;
+
+ if (platform_data->init) {
+ result = platform_data->init();
+ if (result) {
+ printk(KERN_WARNING DRIVER_NAME ": can't reserve gpios\n");
+ goto out_sys;
+ }
+ }
+ max9768->mute_pin = platform_data->mute_pin;
+ max9768->shdn_pin = platform_data->shdn_pin;
+
+ /* shutdown amplifier and activate mute */
+ max9768_shutdown(max9768, 1);
+ max9768_mute(max9768, 1);
+
+ /* set filter mode */
+ max9768_send(client, platform_data->filter_mode);
+
+ printk(DRIVER_NAME " v" DRIVER_VERSION " successfully probed !\n");
+
+ return 0;
+
+out_sys:
+ max9768_remove_sys_entries(client);
+out_free:
+ i2c_set_clientdata(client, NULL);
+ kfree(max9768);
+
+ return result;
+}
+
+static int max9768_remove(struct i2c_client *client)
+{
+ struct max9768 *max9768 = i2c_get_clientdata(client);
+ struct max9768_platform_data *pdata = client->dev.platform_data;
+
+ max9768_remove_sys_entries(client);
+
+ if (pdata->exit)
+ pdata->exit();
+
+ kfree(i2c_get_clientdata(client));
+ kfree(max9768);
+
+ return 0;
+}
+
+#ifdef CONFIG_PM
+static int max9768_suspend(struct i2c_client *client, pm_message_t state)
+{
+ struct max9768 *max9768 = i2c_get_clientdata(client);
+
+ gpio_set_value(max9768->mute_pin, 1);
+ gpio_set_value(max9768->shdn_pin, 0);
+
+ return 0;
+}
+
+static int max9768_resume(struct i2c_client *client)
+{
+ struct max9768 *max9768 = i2c_get_clientdata(client);
+
+ /* reactivate the component just like before suspend */
+ max9768_shutdown(max9768, max9768->shdn_state);
+ max9768_mute(max9768, max9768->mute_state);
+
+ return 0;
+}
+#else
+#define max9768_suspend NULL
+#define max9768_resume NULL
+#endif
+
+
+static const struct i2c_device_id max9768_id[] = {
+ { DRIVER_NAME, 0 },
+ {},
+};
+
+static struct i2c_driver max9768_driver = {
+ .driver = {
+ .name = DRIVER_NAME,
+ .owner = THIS_MODULE,
+ },
+ .probe = max9768_probe,
+ .remove = max9768_remove,
+ .suspend = max9768_suspend,
+ .resume = max9768_resume,
+ .id_table = max9768_id,
+};
+
+static int __init max9768_init(void)
+{
+ int ret;
+
+ ret = i2c_add_driver(&max9768_driver);
+ if (ret)
+ printk(KERN_ERR "Unable to register max9768 driver\n");
+
+ return ret;
+}
+module_init(max9768_init);
+
+static void __exit max9768_exit(void)
+{
+ i2c_del_driver(&max9768_driver);
+}
+module_exit(max9768_exit);
+
+MODULE_AUTHOR("Nicolas Colombain <nic...@ar...>");
+MODULE_DESCRIPTION("MAX9768 audio amplifier driver");
+MODULE_LICENSE("GPL");
+
diff --git a/target/linux/debug/imxregs/definitions.h b/target/linux/modules/max9768/max9768.h
similarity index 60%
copy from target/linux/debug/imxregs/definitions.h
copy to target/linux/modules/max9768/max9768.h
index ee71db3..a92b1ac 100644
--- a/target/linux/debug/imxregs/definitions.h
+++ b/target/linux/modules/max9768/max9768.h
@@ -1,8 +1,8 @@
/*
- * definitions.h - imxregs common definitions
+ * Max9768 audio amplifier driver
*
- * Copyright (C) 2008 armadeus systems
- * Author: Julien Boibessot
+ * Copyright (C) 2009 Armadeus Project / Armadeus Systems
+ * Author: Nicolas Colombain
*
* 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
@@ -20,17 +20,18 @@
*
*/
-typedef unsigned int u32;
+#ifndef __LINUX_MAX9768_H
+#define __LINUX_MAX9768_H
-struct reg_info {
- char *name;
- u32 addr;
- int shift;
- u32 mask;
- char type;
- char *desc;
+#define MAX9768_FILTERLESS_MODE 0xD5
+#define MAX9768_CLASSIC_PWM_MODE 0xD6
+
+struct max9768_platform_data {
+ u8 filter_mode;
+ int mute_pin; /*gpio for mute ctrl */
+ int shdn_pin; /*gpio for shutdown ctrl */
+ int (*init)(void);
+ int (*exit)(void);
};
-// Size of mmapping:
-#define MAP_SIZE 4096
-#define MAP_MASK ( MAP_SIZE - 1 )
+#endif /* __LINUX_MAX9768_H */
hooks/post-receive
--
armadeus
|