From dbe7fc5022feccd172878b8bf6af9b20975ba17e Mon Sep 17 00:00:00 2001 From: Jonas Aaberg Date: Fri, 30 Sep 2011 11:59:44 +0200 Subject: ARM: ux500: Remove outdated sensors1p driver Replaced by gpio-keyboard implementation. ST-Ericsson Linux next: - ST-Ericsson ID: - ST-Ericsson FOSS-OUT ID: Trivial Change-Id: Ic6c8ea1d83c4b3d8ad6bbd9aa06ff30213cab6be Signed-off-by: Jonas Aaberg Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/32695 --- arch/arm/mach-ux500/Kconfig | 7 - arch/arm/mach-ux500/Makefile | 1 - arch/arm/mach-ux500/board-mop500.c | 28 --- arch/arm/mach-ux500/include/mach/sensors1p.h | 24 --- arch/arm/mach-ux500/sensors1p.c | 298 --------------------------- 5 files changed, 358 deletions(-) delete mode 100644 arch/arm/mach-ux500/include/mach/sensors1p.h delete mode 100644 arch/arm/mach-ux500/sensors1p.c (limited to 'arch') diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig index 0d7401af91a..1f19ebe9aa2 100644 --- a/arch/arm/mach-ux500/Kconfig +++ b/arch/arm/mach-ux500/Kconfig @@ -86,13 +86,6 @@ config UX500_GPIO_KEYS help Add proximity and hal sensors as a gpio keyboard. -config SENSORS1P_MOP - tristate "HAL and Proximity sensors support" - depends on REGULATOR && (GPIO_STMPE2401 || GPIO_TC35892) - help - Add support for Osram's SFH7741 Proximity Sensor and Samsumg - HED54XXU11 HAL Switch - config U5500_MODEM_IRQ bool "Modem IRQ support" depends on UX500_SOC_DB5500 diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile index 56ae2fe5032..dd633940dfb 100644 --- a/arch/arm/mach-ux500/Makefile +++ b/arch/arm/mach-ux500/Makefile @@ -30,7 +30,6 @@ obj-$(CONFIG_MACH_U8500) += board-mop500.o board-mop500-sdi.o \ board-mop500-wlan.o \ board-mop500-cyttsp.o obj-$(CONFIG_ANDROID_STE_TIMED_VIBRA) += board-mop500-vibra.o -obj-$(CONFIG_SENSORS1P_MOP) += sensors1p.o obj-$(CONFIG_MACH_U5500) += board-u5500.o board-u5500-sdi.o \ board-u5500-mcde.o \ board-u5500-regulators.o \ diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index 5d512186645..3e380863288 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include @@ -851,30 +850,6 @@ struct platform_device u8500_sim_detect_device = { }; #endif -#ifdef CONFIG_SENSORS1P_MOP -static struct sensors1p_config sensors1p_config = { - /* SFH7741 */ - .proximity = { - .pin = EGPIO_PIN_7, - .startup_time = 120, /* ms */ - .regulator = "v-proximity", - }, - /* HED54XXU11 */ - .hal = { - .pin = EGPIO_PIN_8, - .startup_time = 100, /* Actually, I have no clue. */ - .regulator = "v-hal", - }, -}; - -struct platform_device sensors1p_device = { - .name = "sensors1p", - .dev = { - .platform_data = (void *)&sensors1p_config, - }, -}; -#endif - static struct cryp_platform_data u8500_cryp1_platform_data = { .mem_to_engine = { .dir = STEDMA40_MEM_TO_PERIPH, @@ -913,9 +888,6 @@ static struct hash_platform_data u8500_hash1_platform_data = { /* add any platform devices here - TODO */ static struct platform_device *mop500_platform_devs[] __initdata = { -#ifdef CONFIG_SENSORS1P_MOP - &sensors1p_device, -#endif #ifdef CONFIG_U8500_SIM_DETECT &u8500_sim_detect_device, #endif diff --git a/arch/arm/mach-ux500/include/mach/sensors1p.h b/arch/arm/mach-ux500/include/mach/sensors1p.h deleted file mode 100644 index 544e1d8bab5..00000000000 --- a/arch/arm/mach-ux500/include/mach/sensors1p.h +++ /dev/null @@ -1,24 +0,0 @@ - -/* - * Copyright (C) 2009-2010 ST-Ericsson AB - * License terms: GNU General Public License (GPL) version 2 - * Header file for 1 pin gpio sensors; - * Author: Jonas Aaberg - * - */ - -#ifndef __ASM_ARCH_SFH7741_H -#define __ASM_ARCH_SFH7741_H - -struct sensor_config { - int pin; - int startup_time; /* in ms */ - char regulator[32]; -}; - -struct sensors1p_config { - struct sensor_config hal; - struct sensor_config proximity; -}; - -#endif diff --git a/arch/arm/mach-ux500/sensors1p.c b/arch/arm/mach-ux500/sensors1p.c deleted file mode 100644 index e7f4642b1d9..00000000000 --- a/arch/arm/mach-ux500/sensors1p.c +++ /dev/null @@ -1,298 +0,0 @@ - -/* - * Copyright (C) 2009-2010 ST-Ericsson AB - * License terms: GNU General Public License (GPL) version 2 - * Simple userspace interface for - * Proximity Sensor Osram SFH 7741 and HAL switch Samsung HED54XXU11 - * Author: Jonas Aaberg - * - * This driver is only there for making Android happy. It is not ment - * for mainline. - */ - - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -struct sensor { - struct regulator *regulator; - int pin; - int startup_time; - int active; - u64 when_enabled; -}; - -struct sensors1p { - struct sensor hal; - struct sensor proximity; -}; - -static int sensors1p_power_write(struct device *dev, - struct sensor *s, const char *buf) -{ - int val; - - if (sscanf(buf, "%d", &val) != 1) - return -EINVAL; - - if (val != 0 && val != 1) - return -EINVAL; - - if (val != s->active) { - if (val) { - regulator_enable(s->regulator); - s->when_enabled = get_jiffies_64() + - msecs_to_jiffies(s->startup_time); - } else - regulator_disable(s->regulator); - } - s->active = val; - - return strnlen(buf, PAGE_SIZE); - -} - -static ssize_t sensors1p_sysfs_hal_active_set(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - - - struct sensors1p *s = platform_get_drvdata(container_of(dev, - struct platform_device, - dev)); - return sensors1p_power_write(dev, &s->hal, buf); - -} - -static ssize_t sensors1p_sysfs_proximity_active_set(struct device *dev, - struct device_attribute *attr, - const char *buf, - size_t count) -{ - - - struct sensors1p *s = platform_get_drvdata(container_of(dev, - struct platform_device, - dev)); - return sensors1p_power_write(dev, &s->proximity, buf); - -} - -static ssize_t sensors1p_sysfs_hal_active_get(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct sensors1p *s = platform_get_drvdata(container_of(dev, - struct platform_device, - dev)); - return sprintf(buf, "%d", s->hal.active); -} - -static ssize_t sensors1p_sysfs_proximity_active_get(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct sensors1p *s = platform_get_drvdata(container_of(dev, - struct platform_device, - dev)); - return sprintf(buf, "%d", s->proximity.active); -} - -static int sensors1p_read(struct device *dev, struct sensor *s, char *buf) -{ - int ret; - - if (!s->active) - return -EINVAL; - - /* Only wait if read() is called before the sensor is up and running - * Since jiffies wraps, always sleep maximum time. - */ - if (time_before64(get_jiffies_64(), s->when_enabled)) - mdelay(s->startup_time); - - /* For some odd reason, setting direction in the probe function fails */ - ret = gpio_direction_input(s->pin); - - if (ret) - dev_err(dev, "Failed to set GPIO pin %d to input.\n", s->pin); - else - ret = gpio_get_value(s->pin); - - return sprintf(buf, "%d", ret); -} - -static ssize_t sensors1p_sysfs_hal_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct sensors1p *s = platform_get_drvdata(container_of(dev, - struct platform_device, - dev)); - return sensors1p_read(dev, &s->hal, buf); -} - -static ssize_t sensors1p_sysfs_proximity_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct sensors1p *s = platform_get_drvdata(container_of(dev, - struct platform_device, - dev)); - return sensors1p_read(dev, &s->proximity, buf); -} - -static DEVICE_ATTR(proximity_activate, 0666, - sensors1p_sysfs_proximity_active_get, - sensors1p_sysfs_proximity_active_set); -static DEVICE_ATTR(hal_activate, 0666, - sensors1p_sysfs_hal_active_get, - sensors1p_sysfs_hal_active_set); -static DEVICE_ATTR(proximity, 0444, sensors1p_sysfs_proximity_show, NULL); -static DEVICE_ATTR(hal, 0444, sensors1p_sysfs_hal_show, NULL); - -static struct attribute *sensors1p_attrs[] = { - &dev_attr_proximity_activate.attr, - &dev_attr_hal_activate.attr, - &dev_attr_proximity.attr, - &dev_attr_hal.attr, - NULL, -}; - -static struct attribute_group sensors1p_attr_group = { - .name = NULL, - .attrs = sensors1p_attrs, -}; - -static int __init sensors1p_probe(struct platform_device *pdev) -{ - int err = -EINVAL; - struct sensors1p_config *c; - struct sensors1p *s = NULL; - - if (!pdev) - goto out; - - c = pdev->dev.platform_data; - - if (c == NULL) { - dev_err(&pdev->dev, "Error: Missconfigured.\n"); - goto out; - } - - s = kzalloc(sizeof(struct sensors1p), GFP_KERNEL); - - if (s == NULL) { - dev_err(&pdev->dev, - "Could not allocate struct memory!\n"); - err = -ENOMEM; - goto out; - } - - s->hal.pin = c->hal.pin; - err = gpio_request(c->hal.pin, "hal sensor"); - if (err < 0) { - dev_err(&pdev->dev, "gpio_request failed with err: %d", err); - goto err_hal_gpio; - } - - s->proximity.pin = c->proximity.pin; - err = gpio_request(c->proximity.pin, "proximity sensor"); - if (err < 0) { - dev_err(&pdev->dev, "gpio_request failed with err: %d", err); - goto err_proximity_gpio; - } - - s->hal.startup_time = c->hal.startup_time; - s->proximity.startup_time = c->proximity.startup_time; - - - s->hal.regulator = regulator_get(&pdev->dev, c->hal.regulator); - - if (IS_ERR(s->hal.regulator)) { - dev_err(&pdev->dev, "regulator_get(\"%s\") failed.\n", - c->hal.regulator); - err = PTR_ERR(s->hal.regulator); - goto err_hal_reg; - } - s->proximity.regulator = regulator_get(&pdev->dev, - c->proximity.regulator); - - if (IS_ERR(s->proximity.regulator)) { - dev_err(&pdev->dev, "regulator_get(\"%s\") failed.\n", - c->proximity.regulator); - err = PTR_ERR(s->proximity.regulator); - goto err_proximity_reg; - } - - err = sysfs_create_group(&pdev->dev.kobj, &sensors1p_attr_group); - - if (err) { - dev_err(&pdev->dev, "Failed to create sysfs entries.\n"); - goto err_sysfs; - } - - platform_set_drvdata(pdev, s); - - return 0; - -err_sysfs: - regulator_put(s->proximity.regulator); -err_proximity_reg: - regulator_put(s->hal.regulator); -err_hal_reg: - gpio_free(s->proximity.pin); -err_proximity_gpio: - gpio_free(s->hal.pin); -err_hal_gpio: - kfree(s); -out: - return err; -} - -static int __exit sensors1p_remove(struct platform_device *pdev) -{ - struct sensors1p *s = platform_get_drvdata(pdev); - - sysfs_remove_group(&pdev->dev.kobj, &sensors1p_attr_group); - gpio_free(s->hal.pin); - gpio_free(s->proximity.pin); - regulator_put(s->hal.regulator); - regulator_put(s->proximity.regulator); - kfree(s); - return 0; -} - -static struct platform_driver sensors1p_driver = { - .remove = __exit_p(sensors1p_remove), - .driver = { - .name = "sensors1p", - .owner = THIS_MODULE, - }, -}; - -static int __init sensors1p_init(void) -{ - return platform_driver_probe(&sensors1p_driver, sensors1p_probe); -} - -static void __exit sensors1p_exit(void) -{ - platform_driver_unregister(&sensors1p_driver); -} - -late_initcall(sensors1p_init); -module_exit(sensors1p_exit); - -MODULE_AUTHOR("Jonas Aaberg "); -MODULE_DESCRIPTION("One pin gpio sensors driver (Proximity+HAL)"); -MODULE_LICENSE("GPLv2"); -- cgit v1.2.3