CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
# CONFIG_GPIOLIB is not set
# CONFIG_W1 is not set
-CONFIG_POWER_SUPPLY=y
# CONFIG_POWER_SUPPLY_DEBUG is not set
# CONFIG_PDA_POWER is not set
# CONFIG_BATTERY_DS2760 is not set
CONFIG_MARU_FB=y
CONFIG_MARU_CAMERA=y
CONFIG_MARU_BACKLIGHT=y
+CONFIG_MARU_JACK=y
+CONFIG_MARU_POWER_SUPPLY=y
+CONFIG_MARU_USB_MASS_STORAGE=y
+CONFIG_MARU_USB_MODE=y
CONFIG_X86_PLATFORM_DEVICES=y
# CONFIG_ACER_WMI is not set
# CONFIG_ASUS_LAPTOP is not set
obj-y += i2c/ media/
obj-$(CONFIG_PPS) += pps/
obj-$(CONFIG_W1) += w1/
-obj-$(CONFIG_POWER_SUPPLY) += power_supply/
obj-$(CONFIG_HWMON) += hwmon/
obj-$(CONFIG_THERMAL) += thermal/
obj-$(CONFIG_WATCHDOG) += watchdog/
obj-$(CONFIG_STAGING) += staging/
obj-y += platform/
obj-y += ieee802154/
-obj-y += jack/
-obj-y += usb_mode/
-obj-y += usb_mass_storage/
obj-$(CONFIG_MARU) += maru/
+++ /dev/null
-#
-# Character device configuration
-#
-
-menu "Character devices"
-
-source "drivers/jack/Kconfig"
-
-config JACK
- "jack"
-
-
-endmenu
+++ /dev/null
-obj-y += mod_jack.o
+++ /dev/null
-/*\r
- * Virtual device node for event injector of emulator\r
- *\r
- * Copyright (c) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Contact:\r
- * Sungmin Ha <sungmin82.ha@samsung.com>\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
- *\r
- * Contributors:\r
- * - S-Core Co., Ltd\r
- */\r
-\r
-#include <linux/kernel.h>\r
-#include <linux/module.h>\r
-#include <linux/device.h>\r
-#include <linux/platform_device.h>\r
-\r
-int charger_online = 0;\r
-int earjack_online = 0;\r
-int earkey_online = 0;\r
-int hdmi_online = 0;\r
-int usb_online = 0;\r
-\r
-struct my_data {\r
- int no;\r
- char test[50];\r
-};\r
-\r
-static ssize_t show_charger_online(struct device *dev, \r
- struct device_attribute *attr, char *buf) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- return snprintf(buf, PAGE_SIZE, "%d", charger_online);\r
-}\r
-\r
-static ssize_t store_charger_online(struct device *dev, \r
- struct device_attribute *attr, const char *buf, size_t count) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- sscanf(buf, "%d", &charger_online);\r
- return strnlen(buf, PAGE_SIZE);\r
-}\r
-\r
-static ssize_t show_earjack_online(struct device *dev, \r
- struct device_attribute *attr, char *buf) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- return snprintf(buf, PAGE_SIZE, "%d", earjack_online);\r
-}\r
-\r
-static ssize_t store_earjack_online(struct device *dev, \r
- struct device_attribute *attr, const char *buf, size_t count) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- sscanf(buf, "%d", &earjack_online);\r
- return strnlen(buf, PAGE_SIZE);\r
-}\r
-\r
-static ssize_t show_earkey_online(struct device *dev, \r
- struct device_attribute *attr, char *buf) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- return snprintf(buf, PAGE_SIZE, "%d", earkey_online);\r
-}\r
-\r
-static ssize_t store_earkey_online(struct device *dev, \r
- struct device_attribute *attr, const char *buf, size_t count) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- sscanf(buf, "%d", &earkey_online);\r
- return strnlen(buf, PAGE_SIZE);\r
-}\r
-\r
-static ssize_t show_hdmi_online(struct device *dev, \r
- struct device_attribute *attr, char *buf) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- return snprintf(buf, PAGE_SIZE, "%d", hdmi_online);\r
-}\r
-\r
-static ssize_t store_hdmi_online(struct device *dev, \r
- struct device_attribute *attr, const char *buf, size_t count) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- sscanf(buf, "%d", &hdmi_online);\r
- return strnlen(buf, PAGE_SIZE);\r
-}\r
-\r
-static ssize_t show_usb_online(struct device *dev, \r
- struct device_attribute *attr, char *buf) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- return snprintf(buf, PAGE_SIZE, "%d", usb_online);\r
-}\r
-\r
-static ssize_t store_usb_online(struct device *dev, \r
- struct device_attribute *attr, const char *buf, size_t count) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- sscanf(buf, "%d", &usb_online);\r
- return strnlen(buf, PAGE_SIZE);\r
-}\r
-static DEVICE_ATTR(charger_online, S_IRUGO | S_IWUSR, show_charger_online, store_charger_online);\r
-static DEVICE_ATTR(earjack_online, S_IRUGO | S_IWUSR, show_earjack_online, store_earjack_online);\r
-static DEVICE_ATTR(earkey_online, S_IRUGO | S_IWUSR, show_earkey_online, store_earkey_online);\r
-static DEVICE_ATTR(hdmi_online, S_IRUGO | S_IWUSR, show_hdmi_online, store_hdmi_online);\r
-static DEVICE_ATTR(usb_online, S_IRUGO | S_IWUSR, show_usb_online, store_usb_online);\r
-\r
-static int sysfs_test_create_file(struct device *dev) \r
-{\r
- int result = 0;\r
-\r
- printk("[%d] [%s] \n", __LINE__, __FUNCTION__);\r
-\r
- result = device_create_file(dev, &dev_attr_charger_online);\r
- if (result){\r
- printk("[%d] [%s] error \n", __LINE__, __FUNCTION__);\r
- return result;\r
- }\r
-\r
- result = device_create_file(dev, &dev_attr_earjack_online);\r
- if (result){\r
- printk("[%d] [%s] error \n", __LINE__, __FUNCTION__);\r
- return result;\r
- }\r
-\r
- result = device_create_file(dev, &dev_attr_earkey_online);\r
- if (result){\r
- printk("[%d] [%s] error \n", __LINE__, __FUNCTION__);\r
- return result;\r
- }\r
-\r
- result = device_create_file(dev, &dev_attr_hdmi_online);\r
- if (result){\r
- printk("[%d] [%s] error \n", __LINE__, __FUNCTION__);\r
- return result;\r
- }\r
-\r
- result = device_create_file(dev, &dev_attr_usb_online);\r
- if (result){\r
- printk("[%d] [%s] error \n", __LINE__, __FUNCTION__);\r
- return result;\r
- }\r
-\r
- return 0;\r
-}\r
-\r
-\r
-static void sysfs_test_remove_file(struct device *dev) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- device_remove_file(dev, &dev_attr_charger_online);\r
- device_remove_file(dev, &dev_attr_earjack_online);\r
- device_remove_file(dev, &dev_attr_earkey_online);\r
- device_remove_file(dev, &dev_attr_hdmi_online);\r
- device_remove_file(dev, &dev_attr_usb_online);\r
-}\r
-\r
-static void sysfs_test_dev_release(struct device *dev) {}\r
-\r
-static struct platform_device the_pdev = {\r
- .name = "jack",\r
- .id = -1,\r
- .dev = {\r
- .release = sysfs_test_dev_release,\r
- }\r
-};\r
-\r
-static int __init sysfs_test_init(void) \r
-{\r
- int err = 0;\r
- struct my_data *data;\r
-\r
- printk("[%s] \n", __FUNCTION__);\r
-\r
- err = platform_device_register(&the_pdev);\r
- if (err) {\r
- printk("platform_device_register error\n");\r
- return err;\r
- }\r
-\r
- data = kzalloc(sizeof(struct my_data), GFP_KERNEL);\r
- if (!data) {\r
- printk("[%s] kzalloc error\n", __FUNCTION__);\r
- err = -ENOMEM;\r
- goto alloc_err;\r
- }\r
-\r
- dev_set_drvdata(&the_pdev.dev, (void*)data);\r
-\r
- err = sysfs_test_create_file(&the_pdev.dev);\r
- if (err) {\r
- printk("sysfs_create_file error\n");\r
- goto sysfs_err;\r
- }\r
-\r
- return 0;\r
-\r
-sysfs_err:\r
- kfree(data);\r
-\r
-alloc_err:\r
- platform_device_unregister(&the_pdev);\r
- return err;\r
-}\r
-\r
-static void __exit sysfs_test_exit(void) \r
-{\r
- void *data = dev_get_drvdata(&the_pdev.dev);\r
-\r
- printk("[%s] \n", __FUNCTION__);\r
-\r
- kfree(data);\r
- sysfs_test_remove_file(&the_pdev.dev);\r
- platform_device_unregister(&the_pdev);\r
-}\r
-\r
-module_init(sysfs_test_init);\r
-module_exit(sysfs_test_exit);\r
-\r
-\r
-MODULE_LICENSE("GPL");\r
-\r
-\r
help
Say Y to enable the backlight driver of MARU.
+config MARU_JACK
+ tristate "MARU Jack Driver"
+ depends on MARU != n
+
+config MARU_POWER_SUPPLY
+ tristate "MARU Power supply Driver"
+ depends on MARU != n
+
+config MARU_USB_MASS_STORAGE
+ tristate "MARU Usb mass storage Driver"
+ depends on MARU != n
+
+config MARU_USB_MODE
+ tristate "MARU Usb mode Driver"
+ depends on MARU != n
obj-$(CONFIG_MARU_FB) += maru_fb.o
obj-$(CONFIG_MARU_CAMERA) += maru_camera.o
obj-$(CONFIG_MARU_CAMERA) += maru_bl.o
+obj-$(CONFIG_MARU_JACK) += maru_jack.o
+obj-$(CONFIG_MARU_POWER_SUPPLY) += maru_power_supply.o
+obj-$(CONFIG_MARU_USB_MASS_STORAGE) += maru_usb_mass_storage.o
+obj-$(CONFIG_MARU_USB_MODE) += maru_usb_mode.o
--- /dev/null
+/*\r
+ * Virtual device node for event injector of emulator\r
+ *\r
+ * Copyright (c) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Sungmin Ha <sungmin82.ha@samsung.com>\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+\r
+#include <linux/kernel.h>\r
+#include <linux/module.h>\r
+#include <linux/device.h>\r
+#include <linux/platform_device.h>\r
+\r
+int charger_online = 0;\r
+int earjack_online = 0;\r
+int earkey_online = 0;\r
+int hdmi_online = 0;\r
+int usb_online = 0;\r
+\r
+struct my_data {\r
+ int no;\r
+ char test[50];\r
+};\r
+\r
+static ssize_t show_charger_online(struct device *dev, \r
+ struct device_attribute *attr, char *buf) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ return snprintf(buf, PAGE_SIZE, "%d", charger_online);\r
+}\r
+\r
+static ssize_t store_charger_online(struct device *dev, \r
+ struct device_attribute *attr, const char *buf, size_t count) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ sscanf(buf, "%d", &charger_online);\r
+ return strnlen(buf, PAGE_SIZE);\r
+}\r
+\r
+static ssize_t show_earjack_online(struct device *dev, \r
+ struct device_attribute *attr, char *buf) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ return snprintf(buf, PAGE_SIZE, "%d", earjack_online);\r
+}\r
+\r
+static ssize_t store_earjack_online(struct device *dev, \r
+ struct device_attribute *attr, const char *buf, size_t count) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ sscanf(buf, "%d", &earjack_online);\r
+ return strnlen(buf, PAGE_SIZE);\r
+}\r
+\r
+static ssize_t show_earkey_online(struct device *dev, \r
+ struct device_attribute *attr, char *buf) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ return snprintf(buf, PAGE_SIZE, "%d", earkey_online);\r
+}\r
+\r
+static ssize_t store_earkey_online(struct device *dev, \r
+ struct device_attribute *attr, const char *buf, size_t count) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ sscanf(buf, "%d", &earkey_online);\r
+ return strnlen(buf, PAGE_SIZE);\r
+}\r
+\r
+static ssize_t show_hdmi_online(struct device *dev, \r
+ struct device_attribute *attr, char *buf) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ return snprintf(buf, PAGE_SIZE, "%d", hdmi_online);\r
+}\r
+\r
+static ssize_t store_hdmi_online(struct device *dev, \r
+ struct device_attribute *attr, const char *buf, size_t count) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ sscanf(buf, "%d", &hdmi_online);\r
+ return strnlen(buf, PAGE_SIZE);\r
+}\r
+\r
+static ssize_t show_usb_online(struct device *dev, \r
+ struct device_attribute *attr, char *buf) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ return snprintf(buf, PAGE_SIZE, "%d", usb_online);\r
+}\r
+\r
+static ssize_t store_usb_online(struct device *dev, \r
+ struct device_attribute *attr, const char *buf, size_t count) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ sscanf(buf, "%d", &usb_online);\r
+ return strnlen(buf, PAGE_SIZE);\r
+}\r
+static DEVICE_ATTR(charger_online, S_IRUGO | S_IWUSR, show_charger_online, store_charger_online);\r
+static DEVICE_ATTR(earjack_online, S_IRUGO | S_IWUSR, show_earjack_online, store_earjack_online);\r
+static DEVICE_ATTR(earkey_online, S_IRUGO | S_IWUSR, show_earkey_online, store_earkey_online);\r
+static DEVICE_ATTR(hdmi_online, S_IRUGO | S_IWUSR, show_hdmi_online, store_hdmi_online);\r
+static DEVICE_ATTR(usb_online, S_IRUGO | S_IWUSR, show_usb_online, store_usb_online);\r
+\r
+static int sysfs_test_create_file(struct device *dev) \r
+{\r
+ int result = 0;\r
+\r
+ printk("[%d] [%s] \n", __LINE__, __FUNCTION__);\r
+\r
+ result = device_create_file(dev, &dev_attr_charger_online);\r
+ if (result){\r
+ printk("[%d] [%s] error \n", __LINE__, __FUNCTION__);\r
+ return result;\r
+ }\r
+\r
+ result = device_create_file(dev, &dev_attr_earjack_online);\r
+ if (result){\r
+ printk("[%d] [%s] error \n", __LINE__, __FUNCTION__);\r
+ return result;\r
+ }\r
+\r
+ result = device_create_file(dev, &dev_attr_earkey_online);\r
+ if (result){\r
+ printk("[%d] [%s] error \n", __LINE__, __FUNCTION__);\r
+ return result;\r
+ }\r
+\r
+ result = device_create_file(dev, &dev_attr_hdmi_online);\r
+ if (result){\r
+ printk("[%d] [%s] error \n", __LINE__, __FUNCTION__);\r
+ return result;\r
+ }\r
+\r
+ result = device_create_file(dev, &dev_attr_usb_online);\r
+ if (result){\r
+ printk("[%d] [%s] error \n", __LINE__, __FUNCTION__);\r
+ return result;\r
+ }\r
+\r
+ return 0;\r
+}\r
+\r
+\r
+static void sysfs_test_remove_file(struct device *dev) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ device_remove_file(dev, &dev_attr_charger_online);\r
+ device_remove_file(dev, &dev_attr_earjack_online);\r
+ device_remove_file(dev, &dev_attr_earkey_online);\r
+ device_remove_file(dev, &dev_attr_hdmi_online);\r
+ device_remove_file(dev, &dev_attr_usb_online);\r
+}\r
+\r
+static void sysfs_test_dev_release(struct device *dev) {}\r
+\r
+static struct platform_device the_pdev = {\r
+ .name = "jack",\r
+ .id = -1,\r
+ .dev = {\r
+ .release = sysfs_test_dev_release,\r
+ }\r
+};\r
+\r
+static int __init sysfs_test_init(void) \r
+{\r
+ int err = 0;\r
+ struct my_data *data;\r
+\r
+ printk("[%s] \n", __FUNCTION__);\r
+\r
+ err = platform_device_register(&the_pdev);\r
+ if (err) {\r
+ printk("platform_device_register error\n");\r
+ return err;\r
+ }\r
+\r
+ data = kzalloc(sizeof(struct my_data), GFP_KERNEL);\r
+ if (!data) {\r
+ printk("[%s] kzalloc error\n", __FUNCTION__);\r
+ err = -ENOMEM;\r
+ goto alloc_err;\r
+ }\r
+\r
+ dev_set_drvdata(&the_pdev.dev, (void*)data);\r
+\r
+ err = sysfs_test_create_file(&the_pdev.dev);\r
+ if (err) {\r
+ printk("sysfs_create_file error\n");\r
+ goto sysfs_err;\r
+ }\r
+\r
+ return 0;\r
+\r
+sysfs_err:\r
+ kfree(data);\r
+\r
+alloc_err:\r
+ platform_device_unregister(&the_pdev);\r
+ return err;\r
+}\r
+\r
+static void __exit sysfs_test_exit(void) \r
+{\r
+ void *data = dev_get_drvdata(&the_pdev.dev);\r
+\r
+ printk("[%s] \n", __FUNCTION__);\r
+\r
+ kfree(data);\r
+ sysfs_test_remove_file(&the_pdev.dev);\r
+ platform_device_unregister(&the_pdev);\r
+}\r
+\r
+module_init(sysfs_test_init);\r
+module_exit(sysfs_test_exit);\r
+\r
+\r
+MODULE_LICENSE("GPL");\r
+\r
+\r
--- /dev/null
+/*\r
+ * Virtual device node for event injector of emulator\r
+ *\r
+ * Copyright (c) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Sungmin Ha <sungmin82.ha@samsung.com>\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+\r
+#include <linux/kernel.h>\r
+#include <linux/module.h>\r
+#include <linux/device.h>\r
+#include <linux/platform_device.h>\r
+\r
+static struct class *mtd_class;\r
+static struct device* mtd_device;\r
+\r
+static int capacity = 100;\r
+static int charge_full = 1;\r
+static int charge_now = 0;\r
+\r
+static ssize_t show_capacity(struct device *dev, struct device_attribute *attr, char *buf) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ return snprintf(buf, PAGE_SIZE, "%d", capacity);\r
+}\r
+\r
+static ssize_t store_capacity(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ sscanf(buf, "%d", &capacity);\r
+ return strnlen(buf, PAGE_SIZE);\r
+}\r
+\r
+static ssize_t show_charge_full(struct device *dev, struct device_attribute *attr, char *buf) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ return snprintf(buf, PAGE_SIZE, "%d", charge_full);\r
+}\r
+\r
+static ssize_t store_charge_full(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ sscanf(buf, "%d", &charge_full);\r
+ return strnlen(buf, PAGE_SIZE);\r
+}\r
+\r
+static ssize_t show_charge_now(struct device *dev, struct device_attribute *attr, char *buf) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ return snprintf(buf, PAGE_SIZE, "%d", charge_now);\r
+}\r
+\r
+static ssize_t store_charge_now(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ sscanf(buf, "%d", &charge_now);\r
+ return strnlen(buf, PAGE_SIZE);\r
+}\r
+\r
+static struct device_attribute ps_device_attributes[] = {\r
+ __ATTR(capacity, 0644, show_capacity, store_capacity),\r
+ __ATTR(charge_full, 0644, show_charge_full, store_charge_full),\r
+ __ATTR(charge_now, 0644, show_charge_now, store_charge_now),\r
+};\r
+\r
+struct device new_device_dev;\r
+\r
+static int __init sysfs_test_init(void) \r
+{\r
+ int err;\r
+ printk("[%s] \n", __FUNCTION__);\r
+\r
+ mtd_class = class_create(THIS_MODULE, "power_supply");\r
+ mtd_device = device_create(mtd_class, NULL, (dev_t)NULL, NULL, "battery");\r
+ \r
+ err = device_create_file(mtd_device, &ps_device_attributes[0]);\r
+ err = device_create_file(mtd_device, &ps_device_attributes[1]);\r
+ err = device_create_file(mtd_device, &ps_device_attributes[2]);\r
+\r
+ return 0;\r
+}\r
+\r
+static void __exit sysfs_test_exit(void) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ class_destroy(mtd_class);\r
+}\r
+\r
+module_init(sysfs_test_init);\r
+module_exit(sysfs_test_exit);\r
+\r
+\r
+MODULE_LICENSE("GPL");\r
+\r
+\r
--- /dev/null
+/*\r
+ * Virtual device node for event injector of emulator\r
+ *\r
+ * Copyright (c) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Sungmin Ha <sungmin82.ha@samsung.com>\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+\r
+#include <linux/kernel.h>\r
+#include <linux/module.h>\r
+#include <linux/device.h>\r
+#include <linux/platform_device.h>\r
+\r
+static char mode[1024];\r
+static char file0[1024];\r
+static char file1[1024];\r
+\r
+u64 file0_mask = 0x0000000000000000;\r
+u64 file1_mask = 0x0000000000000001;\r
+\r
+struct my_data {\r
+ int no;\r
+ char test[50];\r
+};\r
+\r
+static ssize_t show_mode(struct device *dev, \r
+ struct device_attribute *attr, char *buf) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ return snprintf(buf, PAGE_SIZE, "%s", mode);\r
+}\r
+\r
+static ssize_t store_mode(struct device *dev, \r
+ struct device_attribute *attr, const char *buf, size_t count) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ sscanf(buf, "%s", mode);\r
+ return strnlen(buf, PAGE_SIZE);\r
+}\r
+\r
+static ssize_t show_file(struct device *dev, \r
+ struct device_attribute *attr, char *buf) \r
+{\r
+ ssize_t ret = 0;\r
+ printk("[%s] \n", __FUNCTION__);\r
+ if(*(dev->dma_mask) == file0_mask)\r
+ ret = snprintf(buf, PAGE_SIZE, "%s", file0);\r
+ else\r
+ ret = snprintf(buf, PAGE_SIZE, "%s", file1);\r
+\r
+ return ret;\r
+}\r
+\r
+static ssize_t store_file(struct device *dev, \r
+ struct device_attribute *attr, const char *buf, size_t count) \r
+{\r
+ size_t ret;\r
+ printk("[%s]\n", __FUNCTION__);\r
+ if(*(dev->dma_mask) == file0_mask)\r
+ sscanf(buf, "%s", file0);\r
+ else\r
+ sscanf(buf, "%s", file1);\r
+ \r
+ ret = strnlen(buf, PAGE_SIZE);\r
+ if(ret == 0)\r
+ return 1;\r
+ else\r
+ return strnlen(buf, PAGE_SIZE);\r
+}\r
+\r
+static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, show_mode, store_mode);\r
+static DEVICE_ATTR(file, S_IRUGO | S_IWUSR, show_file, store_file);\r
+\r
+static int sysfs_lun0_create_file(struct device *dev) \r
+{\r
+ int result = 0;\r
+\r
+ printk("[%d] [%s] \n", __LINE__, __FUNCTION__);\r
+\r
+ result = device_create_file(dev, &dev_attr_mode);\r
+ if (result){\r
+ printk("[%d] [%s] error \n", __LINE__, __FUNCTION__);\r
+ return result;\r
+ }\r
+\r
+ result = device_create_file(dev, &dev_attr_file);\r
+ if (result){\r
+ printk("[%d] [%s] error \n", __LINE__, __FUNCTION__);\r
+ return result;\r
+ }\r
+\r
+ return 0;\r
+}\r
+\r
+static int sysfs_lun1_create_file(struct device *dev) \r
+{\r
+ int result = 0;\r
+\r
+ printk("[%d] [%s] \n", __LINE__, __FUNCTION__);\r
+\r
+ result = device_create_file(dev, &dev_attr_file);\r
+ if (result){\r
+ printk("[%d] [%s] error \n", __LINE__, __FUNCTION__);\r
+ return result;\r
+ }\r
+\r
+ return 0;\r
+}\r
+\r
+static void sysfs_test_dev_release(struct device *dev) {}\r
+static void sysfs_test_dev_release_lun0(struct device *dev) {}\r
+\r
+static struct platform_device the_pdev = {\r
+ .name = "usb_mass_storage",\r
+ .id = -1,\r
+ .dev = {\r
+ .release = sysfs_test_dev_release,\r
+ }\r
+};\r
+\r
+static struct platform_device the_pdev_sub1 = {\r
+ .name = "lun0",\r
+ .id = -1, \r
+ .dev = {\r
+ .release = sysfs_test_dev_release_lun0,\r
+ .parent = &the_pdev.dev,\r
+ .dma_mask = &file0_mask,\r
+ }\r
+};\r
+\r
+static struct platform_device the_pdev_sub2 = {\r
+ .name = "lun1",\r
+ .id = -1, \r
+ .dev = {\r
+ .release = sysfs_test_dev_release_lun0,\r
+ .parent = &the_pdev.dev,\r
+ .dma_mask = &file1_mask,\r
+ }\r
+};\r
+\r
+static int __init sysfs_test_init(void) \r
+{\r
+ int err = 0;\r
+ struct my_data *data;\r
+\r
+ printk("[%s] \n", __FUNCTION__);\r
+\r
+ memset(mode, 0, sizeof(mode));\r
+ memset(file0, 0, sizeof(file0));\r
+ memset(file1, 0, sizeof(file1));\r
+\r
+ err = platform_device_register(&the_pdev);\r
+ if (err) {\r
+ printk("platform_device_register error\n");\r
+ return err;\r
+ }\r
+\r
+ err = platform_device_register(&the_pdev_sub1);\r
+ if (err) {\r
+ printk("platform_device_register error\n");\r
+ return err;\r
+ }\r
+\r
+ err = platform_device_register(&the_pdev_sub2);\r
+ if (err) {\r
+ printk("platform_device_register error\n");\r
+ return err;\r
+ }\r
+\r
+ data = kzalloc(sizeof(struct my_data), GFP_KERNEL);\r
+ if (!data) {\r
+ printk("[%s] kzalloc error\n", __FUNCTION__);\r
+ err = -ENOMEM;\r
+ goto alloc_err;\r
+ }\r
+\r
+ dev_set_drvdata(&the_pdev.dev, (void*)data);\r
+ dev_set_drvdata(&the_pdev_sub1.dev, (void*)data);\r
+ dev_set_drvdata(&the_pdev_sub2.dev, (void*)data);\r
+\r
+ err = sysfs_lun0_create_file(&the_pdev_sub1.dev);\r
+ if (err) {\r
+ printk("sysfs_create_file error\n");\r
+ goto sysfs_err;\r
+ }\r
+ \r
+ err = sysfs_lun1_create_file(&the_pdev_sub2.dev);\r
+ if (err) {\r
+ printk("sysfs_create_file error\n");\r
+ goto sysfs_err;\r
+ }\r
+\r
+ return 0;\r
+\r
+sysfs_err:\r
+ kfree(data);\r
+\r
+alloc_err:\r
+ platform_device_unregister(&the_pdev);\r
+ return err;\r
+}\r
+\r
+static void __exit sysfs_test_exit(void) \r
+{\r
+ void *data = dev_get_drvdata(&the_pdev.dev);\r
+\r
+ printk("[%s] \n", __FUNCTION__);\r
+\r
+ kfree(data);\r
+ platform_device_unregister(&the_pdev_sub2);\r
+ platform_device_unregister(&the_pdev_sub1);\r
+ platform_device_unregister(&the_pdev);\r
+}\r
+\r
+module_init(sysfs_test_init);\r
+module_exit(sysfs_test_exit);\r
+\r
+\r
+MODULE_LICENSE("GPL");\r
+\r
+\r
--- /dev/null
+/*\r
+ * Virtual device node for event injector of emulator\r
+ *\r
+ * Copyright (c) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Sungmin Ha <sungmin82.ha@samsung.com>\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+\r
+#include <linux/kernel.h>\r
+#include <linux/module.h>\r
+#include <linux/device.h>\r
+#include <linux/platform_device.h>\r
+\r
+int UsbMenuSel = 0;\r
+\r
+struct my_data {\r
+ int no;\r
+ char test[50];\r
+};\r
+\r
+static ssize_t show_UsbMenuSel(struct device *dev, \r
+ struct device_attribute *attr, char *buf) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ return snprintf(buf, PAGE_SIZE, "%d", UsbMenuSel);\r
+}\r
+\r
+static ssize_t store_UsbMenuSel(struct device *dev, \r
+ struct device_attribute *attr, const char *buf, size_t count) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ sscanf(buf, "%d", &UsbMenuSel);\r
+ return strnlen(buf, PAGE_SIZE);\r
+}\r
+\r
+static DEVICE_ATTR(UsbMenuSel, S_IRUGO | S_IWUSR, show_UsbMenuSel, store_UsbMenuSel);\r
+\r
+static int sysfs_test_create_file(struct device *dev) \r
+{\r
+ int result = 0;\r
+\r
+ printk("[%d] [%s] \n", __LINE__, __FUNCTION__);\r
+\r
+ result = device_create_file(dev, &dev_attr_UsbMenuSel);\r
+ if (result){\r
+ printk("[%d] [%s] error \n", __LINE__, __FUNCTION__);\r
+ return result;\r
+ }\r
+\r
+ return 0;\r
+}\r
+\r
+\r
+static void sysfs_test_remove_file(struct device *dev) \r
+{\r
+ printk("[%s] \n", __FUNCTION__);\r
+ device_remove_file(dev, &dev_attr_UsbMenuSel);\r
+}\r
+\r
+static void sysfs_test_dev_release(struct device *dev) {}\r
+\r
+static struct platform_device the_pdev = {\r
+ .name = "usb_mode",\r
+ .id = -1,\r
+ .dev = {\r
+ .release = sysfs_test_dev_release,\r
+ }\r
+};\r
+\r
+static int __init sysfs_test_init(void) \r
+{\r
+ int err = 0;\r
+ struct my_data *data;\r
+\r
+ printk("[%s] \n", __FUNCTION__);\r
+\r
+ err = platform_device_register(&the_pdev);\r
+ if (err) {\r
+ printk("platform_device_register error\n");\r
+ return err;\r
+ }\r
+\r
+ data = kzalloc(sizeof(struct my_data), GFP_KERNEL);\r
+ if (!data) {\r
+ printk("[%s] kzalloc error\n", __FUNCTION__);\r
+ err = -ENOMEM;\r
+ goto alloc_err;\r
+ }\r
+\r
+ dev_set_drvdata(&the_pdev.dev, (void*)data);\r
+\r
+ err = sysfs_test_create_file(&the_pdev.dev);\r
+ if (err) {\r
+ printk("sysfs_create_file error\n");\r
+ goto sysfs_err;\r
+ }\r
+\r
+ return 0;\r
+\r
+sysfs_err:\r
+ kfree(data);\r
+\r
+alloc_err:\r
+ platform_device_unregister(&the_pdev);\r
+ return err;\r
+}\r
+\r
+static void __exit sysfs_test_exit(void) \r
+{\r
+ void *data = dev_get_drvdata(&the_pdev.dev);\r
+\r
+ printk("[%s] \n", __FUNCTION__);\r
+\r
+ kfree(data);\r
+ sysfs_test_remove_file(&the_pdev.dev);\r
+ platform_device_unregister(&the_pdev);\r
+}\r
+\r
+module_init(sysfs_test_init);\r
+module_exit(sysfs_test_exit);\r
+\r
+\r
+MODULE_LICENSE("GPL");\r
+\r
+\r
+++ /dev/null
-#
-# Character device configuration
-#
-
-menu "Character devices"
-
-source "drivers/power_supply/Kconfig"
-
-config POWER_SUPPLY
- "power supply"
-
-
-endmenu
-
+++ /dev/null
-obj-$(CONFIG_POWER_SUPPLY) += mod_power_supply.o
+++ /dev/null
-/*\r
- * Virtual device node for event injector of emulator\r
- *\r
- * Copyright (c) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Contact:\r
- * Sungmin Ha <sungmin82.ha@samsung.com>\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
- *\r
- * Contributors:\r
- * - S-Core Co., Ltd\r
- */\r
-\r
-#include <linux/kernel.h>\r
-#include <linux/module.h>\r
-#include <linux/device.h>\r
-#include <linux/platform_device.h>\r
-\r
-static struct class *mtd_class;\r
-static struct device* mtd_device;\r
-\r
-static int capacity = 100;\r
-static int charge_full = 1;\r
-static int charge_now = 0;\r
-\r
-static ssize_t show_capacity(struct device *dev, struct device_attribute *attr, char *buf) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- return snprintf(buf, PAGE_SIZE, "%d", capacity);\r
-}\r
-\r
-static ssize_t store_capacity(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- sscanf(buf, "%d", &capacity);\r
- return strnlen(buf, PAGE_SIZE);\r
-}\r
-\r
-static ssize_t show_charge_full(struct device *dev, struct device_attribute *attr, char *buf) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- return snprintf(buf, PAGE_SIZE, "%d", charge_full);\r
-}\r
-\r
-static ssize_t store_charge_full(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- sscanf(buf, "%d", &charge_full);\r
- return strnlen(buf, PAGE_SIZE);\r
-}\r
-\r
-static ssize_t show_charge_now(struct device *dev, struct device_attribute *attr, char *buf) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- return snprintf(buf, PAGE_SIZE, "%d", charge_now);\r
-}\r
-\r
-static ssize_t store_charge_now(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- sscanf(buf, "%d", &charge_now);\r
- return strnlen(buf, PAGE_SIZE);\r
-}\r
-\r
-static struct device_attribute ps_device_attributes[] = {\r
- __ATTR(capacity, 0644, show_capacity, store_capacity),\r
- __ATTR(charge_full, 0644, show_charge_full, store_charge_full),\r
- __ATTR(charge_now, 0644, show_charge_now, store_charge_now),\r
-};\r
-\r
-struct device new_device_dev;\r
-\r
-static int __init sysfs_test_init(void) \r
-{\r
- int err;\r
- printk("[%s] \n", __FUNCTION__);\r
-\r
- mtd_class = class_create(THIS_MODULE, "power_supply");\r
- mtd_device = device_create(mtd_class, NULL, (dev_t)NULL, NULL, "battery");\r
- \r
- err = device_create_file(mtd_device, &ps_device_attributes[0]);\r
- err = device_create_file(mtd_device, &ps_device_attributes[1]);\r
- err = device_create_file(mtd_device, &ps_device_attributes[2]);\r
-\r
- return 0;\r
-}\r
-\r
-static void __exit sysfs_test_exit(void) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- class_destroy(mtd_class);\r
-}\r
-\r
-module_init(sysfs_test_init);\r
-module_exit(sysfs_test_exit);\r
-\r
-\r
-MODULE_LICENSE("GPL");\r
-\r
-\r
+++ /dev/null
-#
-# Character device configuration
-#
-
-menu "Character devices"
-
-source "drivers/usb_mass_storage/Kconfig"
-
-config USB_MASS_STORAGE
- "usb mass storage"
-
-
-endmenu
+++ /dev/null
-obj-y += mod_usb_mass_storage.o
+++ /dev/null
-/*\r
- * Virtual device node for event injector of emulator\r
- *\r
- * Copyright (c) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Contact:\r
- * Sungmin Ha <sungmin82.ha@samsung.com>\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
- *\r
- * Contributors:\r
- * - S-Core Co., Ltd\r
- */\r
-\r
-#include <linux/kernel.h>\r
-#include <linux/module.h>\r
-#include <linux/device.h>\r
-#include <linux/platform_device.h>\r
-\r
-static char mode[1024];\r
-static char file0[1024];\r
-static char file1[1024];\r
-\r
-u64 file0_mask = 0x0000000000000000;\r
-u64 file1_mask = 0x0000000000000001;\r
-\r
-struct my_data {\r
- int no;\r
- char test[50];\r
-};\r
-\r
-static ssize_t show_mode(struct device *dev, \r
- struct device_attribute *attr, char *buf) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- return snprintf(buf, PAGE_SIZE, "%s", mode);\r
-}\r
-\r
-static ssize_t store_mode(struct device *dev, \r
- struct device_attribute *attr, const char *buf, size_t count) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- sscanf(buf, "%s", mode);\r
- return strnlen(buf, PAGE_SIZE);\r
-}\r
-\r
-static ssize_t show_file(struct device *dev, \r
- struct device_attribute *attr, char *buf) \r
-{\r
- ssize_t ret = 0;\r
- printk("[%s] \n", __FUNCTION__);\r
- if(*(dev->dma_mask) == file0_mask)\r
- ret = snprintf(buf, PAGE_SIZE, "%s", file0);\r
- else\r
- ret = snprintf(buf, PAGE_SIZE, "%s", file1);\r
-\r
- return ret;\r
-}\r
-\r
-static ssize_t store_file(struct device *dev, \r
- struct device_attribute *attr, const char *buf, size_t count) \r
-{\r
- size_t ret;\r
- printk("[%s]\n", __FUNCTION__);\r
- if(*(dev->dma_mask) == file0_mask)\r
- sscanf(buf, "%s", file0);\r
- else\r
- sscanf(buf, "%s", file1);\r
- \r
- ret = strnlen(buf, PAGE_SIZE);\r
- if(ret == 0)\r
- return 1;\r
- else\r
- return strnlen(buf, PAGE_SIZE);\r
-}\r
-\r
-static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, show_mode, store_mode);\r
-static DEVICE_ATTR(file, S_IRUGO | S_IWUSR, show_file, store_file);\r
-\r
-static int sysfs_lun0_create_file(struct device *dev) \r
-{\r
- int result = 0;\r
-\r
- printk("[%d] [%s] \n", __LINE__, __FUNCTION__);\r
-\r
- result = device_create_file(dev, &dev_attr_mode);\r
- if (result){\r
- printk("[%d] [%s] error \n", __LINE__, __FUNCTION__);\r
- return result;\r
- }\r
-\r
- result = device_create_file(dev, &dev_attr_file);\r
- if (result){\r
- printk("[%d] [%s] error \n", __LINE__, __FUNCTION__);\r
- return result;\r
- }\r
-\r
- return 0;\r
-}\r
-\r
-static int sysfs_lun1_create_file(struct device *dev) \r
-{\r
- int result = 0;\r
-\r
- printk("[%d] [%s] \n", __LINE__, __FUNCTION__);\r
-\r
- result = device_create_file(dev, &dev_attr_file);\r
- if (result){\r
- printk("[%d] [%s] error \n", __LINE__, __FUNCTION__);\r
- return result;\r
- }\r
-\r
- return 0;\r
-}\r
-\r
-static void sysfs_test_dev_release(struct device *dev) {}\r
-static void sysfs_test_dev_release_lun0(struct device *dev) {}\r
-\r
-static struct platform_device the_pdev = {\r
- .name = "usb_mass_storage",\r
- .id = -1,\r
- .dev = {\r
- .release = sysfs_test_dev_release,\r
- }\r
-};\r
-\r
-static struct platform_device the_pdev_sub1 = {\r
- .name = "lun0",\r
- .id = -1, \r
- .dev = {\r
- .release = sysfs_test_dev_release_lun0,\r
- .parent = &the_pdev.dev,\r
- .dma_mask = &file0_mask,\r
- }\r
-};\r
-\r
-static struct platform_device the_pdev_sub2 = {\r
- .name = "lun1",\r
- .id = -1, \r
- .dev = {\r
- .release = sysfs_test_dev_release_lun0,\r
- .parent = &the_pdev.dev,\r
- .dma_mask = &file1_mask,\r
- }\r
-};\r
-\r
-static int __init sysfs_test_init(void) \r
-{\r
- int err = 0;\r
- struct my_data *data;\r
-\r
- printk("[%s] \n", __FUNCTION__);\r
-\r
- memset(mode, 0, sizeof(mode));\r
- memset(file0, 0, sizeof(file0));\r
- memset(file1, 0, sizeof(file1));\r
-\r
- err = platform_device_register(&the_pdev);\r
- if (err) {\r
- printk("platform_device_register error\n");\r
- return err;\r
- }\r
-\r
- err = platform_device_register(&the_pdev_sub1);\r
- if (err) {\r
- printk("platform_device_register error\n");\r
- return err;\r
- }\r
-\r
- err = platform_device_register(&the_pdev_sub2);\r
- if (err) {\r
- printk("platform_device_register error\n");\r
- return err;\r
- }\r
-\r
- data = kzalloc(sizeof(struct my_data), GFP_KERNEL);\r
- if (!data) {\r
- printk("[%s] kzalloc error\n", __FUNCTION__);\r
- err = -ENOMEM;\r
- goto alloc_err;\r
- }\r
-\r
- dev_set_drvdata(&the_pdev.dev, (void*)data);\r
- dev_set_drvdata(&the_pdev_sub1.dev, (void*)data);\r
- dev_set_drvdata(&the_pdev_sub2.dev, (void*)data);\r
-\r
- err = sysfs_lun0_create_file(&the_pdev_sub1.dev);\r
- if (err) {\r
- printk("sysfs_create_file error\n");\r
- goto sysfs_err;\r
- }\r
- \r
- err = sysfs_lun1_create_file(&the_pdev_sub2.dev);\r
- if (err) {\r
- printk("sysfs_create_file error\n");\r
- goto sysfs_err;\r
- }\r
-\r
- return 0;\r
-\r
-sysfs_err:\r
- kfree(data);\r
-\r
-alloc_err:\r
- platform_device_unregister(&the_pdev);\r
- return err;\r
-}\r
-\r
-static void __exit sysfs_test_exit(void) \r
-{\r
- void *data = dev_get_drvdata(&the_pdev.dev);\r
-\r
- printk("[%s] \n", __FUNCTION__);\r
-\r
- kfree(data);\r
- platform_device_unregister(&the_pdev_sub2);\r
- platform_device_unregister(&the_pdev_sub1);\r
- platform_device_unregister(&the_pdev);\r
-}\r
-\r
-module_init(sysfs_test_init);\r
-module_exit(sysfs_test_exit);\r
-\r
-\r
-MODULE_LICENSE("GPL");\r
-\r
-\r
+++ /dev/null
-#
-# Character device configuration
-#
-
-menu "Character devices"
-
-source "drivers/usb_mode/Kconfig"
-
-config USB_MODE
- "usb_mode"
-
-
-endmenu
+++ /dev/null
-obj-y += mod_usb_mode.o
+++ /dev/null
-/*\r
- * Virtual device node for event injector of emulator\r
- *\r
- * Copyright (c) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Contact:\r
- * Sungmin Ha <sungmin82.ha@samsung.com>\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
- *\r
- * Contributors:\r
- * - S-Core Co., Ltd\r
- */\r
-\r
-#include <linux/kernel.h>\r
-#include <linux/module.h>\r
-#include <linux/device.h>\r
-#include <linux/platform_device.h>\r
-\r
-int UsbMenuSel = 0;\r
-\r
-struct my_data {\r
- int no;\r
- char test[50];\r
-};\r
-\r
-static ssize_t show_UsbMenuSel(struct device *dev, \r
- struct device_attribute *attr, char *buf) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- return snprintf(buf, PAGE_SIZE, "%d", UsbMenuSel);\r
-}\r
-\r
-static ssize_t store_UsbMenuSel(struct device *dev, \r
- struct device_attribute *attr, const char *buf, size_t count) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- sscanf(buf, "%d", &UsbMenuSel);\r
- return strnlen(buf, PAGE_SIZE);\r
-}\r
-\r
-static DEVICE_ATTR(UsbMenuSel, S_IRUGO | S_IWUSR, show_UsbMenuSel, store_UsbMenuSel);\r
-\r
-static int sysfs_test_create_file(struct device *dev) \r
-{\r
- int result = 0;\r
-\r
- printk("[%d] [%s] \n", __LINE__, __FUNCTION__);\r
-\r
- result = device_create_file(dev, &dev_attr_UsbMenuSel);\r
- if (result){\r
- printk("[%d] [%s] error \n", __LINE__, __FUNCTION__);\r
- return result;\r
- }\r
-\r
- return 0;\r
-}\r
-\r
-\r
-static void sysfs_test_remove_file(struct device *dev) \r
-{\r
- printk("[%s] \n", __FUNCTION__);\r
- device_remove_file(dev, &dev_attr_UsbMenuSel);\r
-}\r
-\r
-static void sysfs_test_dev_release(struct device *dev) {}\r
-\r
-static struct platform_device the_pdev = {\r
- .name = "usb_mode",\r
- .id = -1,\r
- .dev = {\r
- .release = sysfs_test_dev_release,\r
- }\r
-};\r
-\r
-static int __init sysfs_test_init(void) \r
-{\r
- int err = 0;\r
- struct my_data *data;\r
-\r
- printk("[%s] \n", __FUNCTION__);\r
-\r
- err = platform_device_register(&the_pdev);\r
- if (err) {\r
- printk("platform_device_register error\n");\r
- return err;\r
- }\r
-\r
- data = kzalloc(sizeof(struct my_data), GFP_KERNEL);\r
- if (!data) {\r
- printk("[%s] kzalloc error\n", __FUNCTION__);\r
- err = -ENOMEM;\r
- goto alloc_err;\r
- }\r
-\r
- dev_set_drvdata(&the_pdev.dev, (void*)data);\r
-\r
- err = sysfs_test_create_file(&the_pdev.dev);\r
- if (err) {\r
- printk("sysfs_create_file error\n");\r
- goto sysfs_err;\r
- }\r
-\r
- return 0;\r
-\r
-sysfs_err:\r
- kfree(data);\r
-\r
-alloc_err:\r
- platform_device_unregister(&the_pdev);\r
- return err;\r
-}\r
-\r
-static void __exit sysfs_test_exit(void) \r
-{\r
- void *data = dev_get_drvdata(&the_pdev.dev);\r
-\r
- printk("[%s] \n", __FUNCTION__);\r
-\r
- kfree(data);\r
- sysfs_test_remove_file(&the_pdev.dev);\r
- platform_device_unregister(&the_pdev);\r
-}\r
-\r
-module_init(sysfs_test_init);\r
-module_exit(sysfs_test_exit);\r
-\r
-\r
-MODULE_LICENSE("GPL");\r
-\r
-\r