Merge "diag: Prevent crash due to buffer over run" into msm-3.0
diff --git a/arch/arm/configs/msm-copper_defconfig b/arch/arm/configs/msm-copper_defconfig
index 8492aa3..1379334 100644
--- a/arch/arm/configs/msm-copper_defconfig
+++ b/arch/arm/configs/msm-copper_defconfig
@@ -32,19 +32,19 @@
CONFIG_ARCH_MSMCOPPER=y
CONFIG_MSM_KRAIT_TBB_ABORT_HANDLER=y
# CONFIG_MSM_STACKED_MEMORY is not set
-CONFIG_DEBUG_MSMCOPPER_UART=y
CONFIG_CPU_HAS_L2_PMU=y
-# CONFIG_MSM_JTAG_V7 is not set
# CONFIG_MSM_FIQ_SUPPORT is not set
# CONFIG_MSM_PROC_COMM is not set
# CONFIG_MSM_DALRPC is not set
# CONFIG_MSM_HW3D is not set
CONFIG_MSM_DIRECT_SCLK_ACCESS=y
+# CONFIG_MSM_JTAG_V7 is not set
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_SMP=y
# CONFIG_SMP_ON_UP is not set
CONFIG_ARM_ARCH_TIMER=y
+CONFIG_HOTPLUG_CPU=y
CONFIG_PREEMPT=y
CONFIG_AEABI=y
CONFIG_HIGHMEM=y
@@ -56,7 +56,6 @@
CONFIG_NEON=y
# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
# CONFIG_SUSPEND is not set
-CONFIG_HOTPLUG_CPU=y
CONFIG_NET=y
CONFIG_UNIX=y
CONFIG_INET=y
@@ -111,7 +110,6 @@
CONFIG_MMC_MSM=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
-# CONFIG_LEDS_MSM_PMIC is not set
CONFIG_SWITCH=y
CONFIG_STAGING=y
CONFIG_ANDROID=y
diff --git a/arch/arm/configs/msm8960-perf_defconfig b/arch/arm/configs/msm8960-perf_defconfig
index 4d50c10..03e27be 100644
--- a/arch/arm/configs/msm8960-perf_defconfig
+++ b/arch/arm/configs/msm8960-perf_defconfig
@@ -239,13 +239,12 @@
# CONFIG_NETDEV_10000 is not set
CONFIG_WCNSS_CORE=y
CONFIG_USB_USBNET=y
+CONFIG_MSM_RMNET_USB=y
CONFIG_SLIP=y
CONFIG_SLIP_COMPRESSED=y
CONFIG_SLIP_MODE_SLIP6=y
# CONFIG_MSM_RMNET is not set
CONFIG_MSM_RMNET_BAM=y
-CONFIG_USB_USBNET=y
-CONFIG_MSM_RMNET_USB=y
CONFIG_INPUT_EVDEV=y
CONFIG_INPUT_EVBUG=m
CONFIG_KEYBOARD_PMIC8XXX=y
diff --git a/arch/arm/configs/msm8960_defconfig b/arch/arm/configs/msm8960_defconfig
index 83de36e..678afc6 100644
--- a/arch/arm/configs/msm8960_defconfig
+++ b/arch/arm/configs/msm8960_defconfig
@@ -239,13 +239,12 @@
# CONFIG_NETDEV_10000 is not set
CONFIG_WCNSS_CORE=y
CONFIG_USB_USBNET=y
+CONFIG_MSM_RMNET_USB=y
CONFIG_SLIP=y
CONFIG_SLIP_COMPRESSED=y
CONFIG_SLIP_MODE_SLIP6=y
# CONFIG_MSM_RMNET is not set
CONFIG_MSM_RMNET_BAM=y
-CONFIG_USB_USBNET=y
-CONFIG_MSM_RMNET_USB=y
CONFIG_INPUT_EVDEV=y
CONFIG_INPUT_EVBUG=m
CONFIG_KEYBOARD_PMIC8XXX=y
@@ -318,7 +317,6 @@
CONFIG_FB_MSM_OVERLAY0_WRITEBACK=y
CONFIG_FB_MSM_MIPI_PANEL_DETECT=y
CONFIG_FB_MSM_HDMI_MSM_PANEL=y
-# CONFIG_FB_MSM_WRITEBACK_MSM_PANEL is not set
CONFIG_BACKLIGHT_LCD_SUPPORT=y
CONFIG_BACKLIGHT_CLASS_DEVICE=y
CONFIG_SOUND=y
diff --git a/arch/arm/configs/msm9615_defconfig b/arch/arm/configs/msm9615_defconfig
index 9d32aa0..31bde4d 100644
--- a/arch/arm/configs/msm9615_defconfig
+++ b/arch/arm/configs/msm9615_defconfig
@@ -139,7 +139,6 @@
CONFIG_THERMAL=y
CONFIG_THERMAL_TSENS8960=y
CONFIG_MFD_PM8018_CORE=y
-CONFIG_REGULATOR=y
CONFIG_REGULATOR_PM8XXX=y
CONFIG_REGULATOR_GPIO=y
# CONFIG_HID_SUPPORT is not set
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig
index dc40384..d311962 100644
--- a/arch/arm/mach-msm/Kconfig
+++ b/arch/arm/mach-msm/Kconfig
@@ -292,8 +292,10 @@
bool
config ARCH_MSM_CORTEX_A5
- bool
+ select PERF_EVENTS
+ select HAVE_HW_BREAKPOINT
select HAVE_HW_BRKPT_RESERVED_RW_ACCESS
+ bool
config ARCH_MSM7X27A
bool
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index 297d4e0..95f2535 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -225,10 +225,10 @@
obj-$(CONFIG_MACH_MSM7X27_SURF) += board-msm7x27.o devices-msm7x27.o
obj-$(CONFIG_MACH_MSM7X27_FFA) += board-msm7x27.o devices-msm7x27.o
obj-$(CONFIG_ARCH_MSM7X27A) += clock-pcom-lookup.o devices-msm7x27a.o
-obj-$(CONFIG_MACH_MSM7X27A_RUMI3) += board-msm7x27a.o board-msm7627a-storage.o board-msm7627a-bt.o board-msm7627a-camera.o
-obj-$(CONFIG_MACH_MSM7X27A_SURF) += board-msm7x27a.o board-msm7627a-storage.o board-msm7627a-bt.o board-msm7627a-camera.o
-obj-$(CONFIG_MACH_MSM7X27A_FFA) += board-msm7x27a.o board-msm7627a-storage.o board-msm7627a-bt.o board-msm7627a-camera.o
-obj-$(CONFIG_MACH_MSM7627A_QRD1) += board-qrd7627a.o board-msm7627a-storage.o board-msm7627a-bt.o board-msm7627a-camera.o
+obj-$(CONFIG_MACH_MSM7X27A_RUMI3) += board-msm7x27a.o board-msm7627a-storage.o board-msm7627a-bt.o
+obj-$(CONFIG_MACH_MSM7X27A_SURF) += board-msm7x27a.o board-msm7627a-storage.o board-msm7627a-bt.o
+obj-$(CONFIG_MACH_MSM7X27A_FFA) += board-msm7x27a.o board-msm7627a-storage.o board-msm7627a-bt.o
+obj-$(CONFIG_MACH_MSM7627A_QRD1) += board-qrd7627a.o board-msm7627a-storage.o board-msm7627a-bt.o
obj-$(CONFIG_ARCH_MSM7X30) += board-msm7x30.o devices-msm7x30.o memory_topology.o
obj-$(CONFIG_ARCH_MSM7X30) += clock-local.o clock-7x30.o acpuclock-7x30.o
obj-$(CONFIG_MACH_MSM7X25_SURF) += board-msm7x27.o devices-msm7x25.o
diff --git a/arch/arm/mach-msm/board-msm7627a-camera.c b/arch/arm/mach-msm/board-msm7627a-camera.c
deleted file mode 100644
index 61a6c6b..0000000
--- a/arch/arm/mach-msm/board-msm7627a-camera.c
+++ /dev/null
@@ -1,527 +0,0 @@
-/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <linux/i2c.h>
-#include <linux/i2c/sx150x.h>
-#include <linux/gpio.h>
-#include <linux/regulator/consumer.h>
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-#include <asm/mach-types.h>
-#include <mach/msm_iomap.h>
-#include <mach/board.h>
-#include <mach/irqs-7xxx.h>
-#include "devices-msm7x2xa.h"
-#include "board-msm7627a.h"
-
-static uint32_t camera_off_gpio_table[] = {
- GPIO_CFG(15, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
-};
-
-static uint32_t camera_on_gpio_table[] = {
- GPIO_CFG(15, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
-};
-
-#ifdef CONFIG_MSM_CAMERA_FLASH
-static struct msm_camera_sensor_flash_src msm_flash_src = {
- .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
- ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
- ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
-};
-#endif
-
-static struct regulator_bulk_data regs_camera[] = {
- { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
- { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
- { .supply = "usb2", .min_uV = 1800000, .max_uV = 1800000 },
-};
-
-void qrd1_camera_gpio_cfg(void)
-{
-
- int rc = 0;
-
- rc = gpio_request(QRD_GPIO_CAM_5MP_SHDN_EN, "ov5640");
- if (rc < 0)
- pr_err("%s: gpio_request---GPIO_CAM_5MP_SHDN_EN failed!",
- __func__);
-
-
- rc = gpio_tlmm_config(GPIO_CFG(QRD_GPIO_CAM_5MP_SHDN_EN, 0,
- GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
- GPIO_CFG_2MA), GPIO_CFG_ENABLE);
- if (rc < 0) {
- pr_err("%s: unable to enable Power Down gpio for main"
- "camera!\n", __func__);
- gpio_free(QRD_GPIO_CAM_5MP_SHDN_EN);
- }
-
-
- rc = gpio_request(QRD_GPIO_CAM_5MP_RESET, "ov5640");
- if (rc < 0) {
- pr_err("%s: gpio_request---GPIO_CAM_5MP_RESET failed!",
- __func__);
- gpio_free(QRD_GPIO_CAM_5MP_SHDN_EN);
- }
-
-
- rc = gpio_tlmm_config(GPIO_CFG(QRD_GPIO_CAM_5MP_RESET, 0,
- GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
- GPIO_CFG_2MA), GPIO_CFG_ENABLE);
- if (rc < 0) {
- pr_err("%s: unable to enable reset gpio for main camera!\n",
- __func__);
- gpio_free(QRD_GPIO_CAM_5MP_RESET);
- }
-
- rc = gpio_request(QRD_GPIO_CAM_3MP_PWDN, "ov7692");
- if (rc < 0)
- pr_err("%s: gpio_request---GPIO_CAM_3MP_PWDN failed!",
- __func__);
-
- rc = gpio_tlmm_config(GPIO_CFG(QRD_GPIO_CAM_3MP_PWDN, 0,
- GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
- GPIO_CFG_2MA), GPIO_CFG_ENABLE);
- if (rc < 0) {
- pr_err("%s: unable to enable Power Down gpio for front"
- "camera!\n", __func__);
- gpio_free(QRD_GPIO_CAM_3MP_PWDN);
- }
-
- gpio_direction_output(QRD_GPIO_CAM_5MP_SHDN_EN, 1);
- gpio_direction_output(QRD_GPIO_CAM_5MP_RESET, 1);
- gpio_direction_output(QRD_GPIO_CAM_3MP_PWDN, 1);
-}
-
-static void msm_camera_vreg_config(int vreg_en)
-{
- int rc = vreg_en ?
- regulator_bulk_enable(ARRAY_SIZE(regs_camera), regs_camera) :
- regulator_bulk_disable(ARRAY_SIZE(regs_camera), regs_camera);
-
- if (rc)
- pr_err("%s: could not %sable regulators: %d\n",
- __func__, vreg_en ? "en" : "dis", rc);
-}
-
-static int config_gpio_table(uint32_t *table, int len)
-{
- int rc = 0, i = 0;
-
- for (i = 0; i < len; i++) {
- rc = gpio_tlmm_config(table[i], GPIO_CFG_ENABLE);
- if (rc) {
- pr_err("%s not able to get gpio\n", __func__);
- for (i--; i >= 0; i--)
- gpio_tlmm_config(camera_off_gpio_table[i],
- GPIO_CFG_ENABLE);
- break;
- }
- }
- return rc;
-}
-
-static int config_camera_on_gpios_rear(void)
-{
- int rc = 0;
-
- if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
- msm_camera_vreg_config(1);
-
- rc = config_gpio_table(camera_on_gpio_table,
- ARRAY_SIZE(camera_on_gpio_table));
- if (rc < 0) {
- pr_err("%s: CAMSENSOR gpio table request"
- "failed\n", __func__);
- return rc;
- }
-
- return rc;
-}
-
-static void config_camera_off_gpios_rear(void)
-{
- if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
- msm_camera_vreg_config(0);
-
- config_gpio_table(camera_off_gpio_table,
- ARRAY_SIZE(camera_off_gpio_table));
-}
-
-static int config_camera_on_gpios_front(void)
-{
- int rc = 0;
-
- if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
- msm_camera_vreg_config(1);
-
- rc = config_gpio_table(camera_on_gpio_table,
- ARRAY_SIZE(camera_on_gpio_table));
- if (rc < 0) {
- pr_err("%s: CAMSENSOR gpio table request"
- "failed\n", __func__);
- return rc;
- }
-
- return rc;
-}
-
-static void config_camera_off_gpios_front(void)
-{
- if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
- msm_camera_vreg_config(0);
-
- config_gpio_table(camera_off_gpio_table,
- ARRAY_SIZE(camera_off_gpio_table));
-}
-
-struct msm_camera_device_platform_data msm_camera_device_data_rear = {
- .camera_gpio_on = config_camera_on_gpios_rear,
- .camera_gpio_off = config_camera_off_gpios_rear,
- .ioext.csiphy = 0xA1000000,
- .ioext.csisz = 0x00100000,
- .ioext.csiirq = INT_CSI_IRQ_1,
- .ioclk.mclk_clk_rate = 24000000,
- .ioclk.vfe_clk_rate = 192000000,
- .ioext.appphy = MSM_CLK_CTL_PHYS,
- .ioext.appsz = MSM_CLK_CTL_SIZE,
-};
-
-struct msm_camera_device_platform_data msm_camera_device_data_front = {
- .camera_gpio_on = config_camera_on_gpios_front,
- .camera_gpio_off = config_camera_off_gpios_front,
- .ioext.csiphy = 0xA0F00000,
- .ioext.csisz = 0x00100000,
- .ioext.csiirq = INT_CSI_IRQ_0,
- .ioclk.mclk_clk_rate = 24000000,
- .ioclk.vfe_clk_rate = 192000000,
- .ioext.appphy = MSM_CLK_CTL_PHYS,
- .ioext.appsz = MSM_CLK_CTL_SIZE,
-};
-
-#ifdef CONFIG_S5K4E1
-static struct msm_camera_sensor_platform_info s5k4e1_sensor_7627a_info = {
- .mount_angle = 90
-};
-
-static struct msm_camera_sensor_flash_data flash_s5k4e1 = {
- .flash_type = MSM_CAMERA_FLASH_LED,
- .flash_src = &msm_flash_src
-};
-
-static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data = {
- .sensor_name = "s5k4e1",
- .sensor_reset_enable = 1,
- .sensor_reset = GPIO_CAM_GP_CAMIF_RESET_N,
- .sensor_pwd = 85,
- .vcm_pwd = GPIO_CAM_GP_CAM_PWDN,
- .vcm_enable = 1,
- .pdata = &msm_camera_device_data_rear,
- .flash_data = &flash_s5k4e1,
- .sensor_platform_info = &s5k4e1_sensor_7627a_info,
- .csi_if = 1
-};
-
-static struct platform_device msm_camera_sensor_s5k4e1 = {
- .name = "msm_camera_s5k4e1",
- .dev = {
- .platform_data = &msm_camera_sensor_s5k4e1_data,
- },
-};
-#endif
-
-#ifdef CONFIG_IMX072
-static struct msm_camera_sensor_platform_info imx072_sensor_7627a_info = {
- .mount_angle = 90
-};
-
-static struct msm_camera_sensor_flash_data flash_imx072 = {
- .flash_type = MSM_CAMERA_FLASH_LED,
- .flash_src = &msm_flash_src
-};
-
-static struct msm_camera_sensor_info msm_camera_sensor_imx072_data = {
- .sensor_name = "imx072",
- .sensor_reset_enable = 1,
- .sensor_reset = GPIO_CAM_GP_CAMIF_RESET_N, /* TODO 106,*/
- .sensor_pwd = 85,
- .vcm_pwd = GPIO_CAM_GP_CAM_PWDN,
- .vcm_enable = 1,
- .pdata = &msm_camera_device_data_rear,
- .flash_data = &flash_imx072,
- .sensor_platform_info = &imx072_sensor_7627a_info,
- .csi_if = 1
-};
-
-static struct platform_device msm_camera_sensor_imx072 = {
- .name = "msm_camera_imx072",
- .dev = {
- .platform_data = &msm_camera_sensor_imx072_data,
- },
-};
-#endif
-
-#ifdef CONFIG_WEBCAM_OV9726
-static struct msm_camera_sensor_platform_info ov9726_sensor_7627a_info = {
- .mount_angle = 90
-};
-
-static struct msm_camera_sensor_flash_data flash_ov9726 = {
- .flash_type = MSM_CAMERA_FLASH_NONE,
- .flash_src = &msm_flash_src
-};
-
-static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data = {
- .sensor_name = "ov9726",
- .sensor_reset_enable = 0,
- .sensor_reset = GPIO_CAM_GP_CAM1MP_XCLR,
- .sensor_pwd = 85,
- .vcm_pwd = 1,
- .vcm_enable = 0,
- .pdata = &msm_camera_device_data_front,
- .flash_data = &flash_ov9726,
- .sensor_platform_info = &ov9726_sensor_7627a_info,
- .csi_if = 1
-};
-
-static struct platform_device msm_camera_sensor_ov9726 = {
- .name = "msm_camera_ov9726",
- .dev = {
- .platform_data = &msm_camera_sensor_ov9726_data,
- },
-};
-#else
-static inline void msm_camera_vreg_init(void) { }
-#endif
-
-#ifdef CONFIG_MT9E013
-static struct msm_camera_sensor_platform_info mt9e013_sensor_7627a_info = {
- .mount_angle = 90
-};
-
-static struct msm_camera_sensor_flash_data flash_mt9e013 = {
- .flash_type = MSM_CAMERA_FLASH_LED,
- .flash_src = &msm_flash_src
-};
-
-static struct msm_camera_sensor_info msm_camera_sensor_mt9e013_data = {
- .sensor_name = "mt9e013",
- .sensor_reset = 0,
- .sensor_reset_enable = 1,
- .sensor_pwd = 85,
- .vcm_pwd = 1,
- .vcm_enable = 0,
- .pdata = &msm_camera_device_data_rear,
- .flash_data = &flash_mt9e013,
- .sensor_platform_info = &mt9e013_sensor_7627a_info,
- .csi_if = 1
-};
-
-static struct platform_device msm_camera_sensor_mt9e013 = {
- .name = "msm_camera_mt9e013",
- .dev = {
- .platform_data = &msm_camera_sensor_mt9e013_data,
- },
-};
-#endif
-
-#ifdef CONFIG_OV5640
-static struct msm_camera_sensor_platform_info ov5640_sensor_info = {
- .mount_angle = 90
-};
-
-static struct msm_camera_sensor_flash_src msm_flash_src_ov5640 = {
- .flash_sr_type = MSM_CAMERA_FLASH_SRC_LED,
- ._fsrc.led_src.led_name = "flashlight",
- ._fsrc.led_src.led_name_len = 10,
-};
-
-static struct msm_camera_sensor_flash_data flash_ov5640 = {
- .flash_type = MSM_CAMERA_FLASH_LED,
- .flash_src = &msm_flash_src_ov5640,
-};
-
-static struct msm_camera_sensor_info msm_camera_sensor_ov5640_data = {
- .sensor_name = "ov5640",
- .sensor_reset_enable = 1,
- .sensor_reset = QRD_GPIO_CAM_5MP_RESET,
- .sensor_pwd = QRD_GPIO_CAM_5MP_SHDN_EN,
- .vcm_pwd = 0,
- .vcm_enable = 0,
- .pdata = &msm_camera_device_data_rear,
- .flash_data = &flash_ov5640,
- .sensor_platform_info = &ov5640_sensor_info,
- .csi_if = 1,
-};
-
-static struct platform_device msm_camera_sensor_ov5640 = {
- .name = "msm_camera_ov5640",
- .dev = {
- .platform_data = &msm_camera_sensor_ov5640_data,
- },
-};
-#endif
-
-#ifdef CONFIG_WEBCAM_OV7692_QRD
-static struct msm_camera_sensor_platform_info ov7692_sensor_7627a_info = {
- .mount_angle = 90
-};
-
-static struct msm_camera_sensor_flash_data flash_ov7692 = {
- .flash_type = MSM_CAMERA_FLASH_NONE,
-};
-
-static struct msm_camera_sensor_info msm_camera_sensor_ov7692_data = {
- .sensor_name = "ov7692",
- .sensor_reset_enable = 0,
- .sensor_reset = 0,
- .sensor_pwd = QRD_GPIO_CAM_3MP_PWDN,
- .vcm_pwd = 0,
- .vcm_enable = 0,
- .pdata = &msm_camera_device_data_front,
- .flash_data = &flash_ov7692,
- .sensor_platform_info = &ov7692_sensor_7627a_info,
- .csi_if = 1,
-};
-
-static struct platform_device msm_camera_sensor_ov7692 = {
- .name = "msm_camera_ov7692",
- .dev = {
- .platform_data = &msm_camera_sensor_ov7692_data,
- },
-};
-#endif
-
-enum {
- SX150X_CAM,
-};
-
-static struct sx150x_platform_data sx150x_data[] __initdata = {
- [SX150X_CAM] = {
- .gpio_base = GPIO_CAM_EXPANDER_BASE,
- .oscio_is_gpo = false,
- .io_pullup_ena = 0,
- .io_pulldn_ena = 0,
- .io_open_drain_ena = 0x23,
- .irq_summary = -1,
- },
-};
-
-static struct i2c_board_info cam_exp_i2c_info[] __initdata = {
- {
- I2C_BOARD_INFO("sx1508q", 0x22),
- .platform_data = &sx150x_data[SX150X_CAM],
- },
-};
-
-static struct i2c_board_info i2c_camera_devices[] = {
- #ifdef CONFIG_S5K4E1
- {
- I2C_BOARD_INFO("s5k4e1", 0x36),
- },
- {
- I2C_BOARD_INFO("s5k4e1_af", 0x8c >> 1),
- },
- #endif
- #ifdef CONFIG_WEBCAM_OV9726
- {
- I2C_BOARD_INFO("ov9726", 0x10),
- },
- #endif
- #ifdef CONFIG_IMX072
- {
- I2C_BOARD_INFO("imx072", 0x34),
- },
- #endif
- #ifdef CONFIG_MT9E013
- {
- I2C_BOARD_INFO("mt9e013", 0x6C >> 2),
- },
- #endif
- {
- I2C_BOARD_INFO("sc628a", 0x6E),
- },
-};
-
-static struct i2c_board_info i2c_camera_devices_qrd[] = {
- #ifdef CONFIG_OV5640
- {
- I2C_BOARD_INFO("ov5640", 0x78 >> 1),
- },
- #endif
- #ifdef CONFIG_WEBCAM_OV7692_QRD
- {
- I2C_BOARD_INFO("ov7692", 0x78),
- },
- #endif
-};
-
-static struct platform_device *camera_devices[] __initdata = {
-#ifdef CONFIG_S5K4E1
- &msm_camera_sensor_s5k4e1,
-#endif
-#ifdef CONFIG_IMX072
- &msm_camera_sensor_imx072,
-#endif
-#ifdef CONFIG_WEBCAM_OV9726
- &msm_camera_sensor_ov9726,
-#endif
-#ifdef CONFIG_MT9E013
- &msm_camera_sensor_mt9e013,
-#endif
-#ifdef CONFIG_OV5640
- &msm_camera_sensor_ov5640,
-#endif
-#ifdef CONFIG_WEBCAM_OV7692_QRD
- &msm_camera_sensor_ov7692,
-#endif
-};
-
-static void __init register_i2c_devices(void)
-{
- i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
- cam_exp_i2c_info,
- ARRAY_SIZE(cam_exp_i2c_info));
-}
-
-void __init msm_camera_vreg_init(void)
-{
- int rc;
- platform_add_devices(camera_devices,
- ARRAY_SIZE(camera_devices));
-
- if (!machine_is_msm7627a_qrd1())
- register_i2c_devices();
-
- rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_camera), regs_camera);
-
- if (rc) {
- pr_err("%s: could not get regulators: %d\n", __func__, rc);
- return;
- }
-
- rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera), regs_camera);
-
- if (rc) {
- pr_err("%s: could not set voltages: %d\n", __func__, rc);
- return;
- }
-
- if (machine_is_msm7627a_qrd1())
- i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
- i2c_camera_devices_qrd,
- ARRAY_SIZE(i2c_camera_devices_qrd));
- else
- i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
- i2c_camera_devices,
- ARRAY_SIZE(i2c_camera_devices));
-}
diff --git a/arch/arm/mach-msm/board-msm7627a.h b/arch/arm/mach-msm/board-msm7627a.h
index d470cab..4680a31 100644
--- a/arch/arm/mach-msm/board-msm7627a.h
+++ b/arch/arm/mach-msm/board-msm7627a.h
@@ -15,53 +15,6 @@
void __init msm7627a_init_mmc(void);
-enum {
- GPIO_EXPANDER_IRQ_BASE = NR_MSM_IRQS + NR_GPIO_IRQS,
- GPIO_EXPANDER_GPIO_BASE = NR_MSM_GPIOS,
- /* SURF expander */
- GPIO_CORE_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
- GPIO_BT_SYS_REST_EN = GPIO_CORE_EXPANDER_BASE,
- GPIO_WLAN_EXT_POR_N,
- GPIO_DISPLAY_PWR_EN,
- GPIO_BACKLIGHT_EN,
- GPIO_PRESSURE_XCLR,
- GPIO_VREG_S3_EXP,
- GPIO_UBM2M_PWRDWN,
- GPIO_ETM_MODE_CS_N,
- GPIO_HOST_VBUS_EN,
- GPIO_SPI_MOSI,
- GPIO_SPI_MISO,
- GPIO_SPI_CLK,
- GPIO_SPI_CS0_N,
- GPIO_CORE_EXPANDER_IO13,
- GPIO_CORE_EXPANDER_IO14,
- GPIO_CORE_EXPANDER_IO15,
- /* Camera expander */
- GPIO_CAM_EXPANDER_BASE = GPIO_CORE_EXPANDER_BASE + 16,
- GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
- GPIO_CAM_GP_AFBUSY,
- GPIO_CAM_GP_CAM_PWDN,
- GPIO_CAM_GP_CAM1MP_XCLR,
- GPIO_CAM_GP_CAMIF_RESET_N,
- GPIO_CAM_GP_STROBE_CE,
- GPIO_CAM_GP_LED_EN1,
- GPIO_CAM_GP_LED_EN2,
-};
-
-enum {
- QRD_GPIO_HOST_VBUS_EN = 107,
- QRD_GPIO_BT_SYS_REST_EN = 114,
- QRD_GPIO_WAKE_ON_WIRELESS,
- QRD_GPIO_BACKLIGHT_EN,
- QRD_GPIO_NC,
- QRD_GPIO_CAM_3MP_PWDN, /* CAM_VGA */
- QRD_GPIO_WLAN_EN,
- QRD_GPIO_CAM_5MP_SHDN_EN,
- QRD_GPIO_CAM_5MP_RESET,
- QRD_GPIO_TP,
- QRD_GPIO_CAM_GP_CAMIF_RESET,
-};
-
#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
#define FPGA_MSM_CNTRL_REG2 0x90008010
@@ -77,7 +30,7 @@
#define FM_I2S_WS_MODE 0x8F
#define FM_I2S_SCK_MODE 0x90
#define I2C_PIN_CTL 0x15
-#define I2C_NORMAL 0x40
+#define I2C_NORMAL 0x40
struct bahama_config_register {
u8 reg;
@@ -99,7 +52,4 @@
void __init msm7627a_bt_power_init(void);
#endif
-void qrd1_camera_gpio_cfg(void);
-void __init msm_camera_vreg_init(void);
-
#endif
diff --git a/arch/arm/mach-msm/board-msm7x27a.c b/arch/arm/mach-msm/board-msm7x27a.c
index db63f53..389b071 100644
--- a/arch/arm/mach-msm/board-msm7x27a.c
+++ b/arch/arm/mach-msm/board-msm7x27a.c
@@ -58,6 +58,39 @@
#define PMEM_KERNEL_EBI1_SIZE 0x3A000
#define MSM_PMEM_AUDIO_SIZE 0x5B000
+enum {
+ GPIO_EXPANDER_IRQ_BASE = NR_MSM_IRQS + NR_GPIO_IRQS,
+ GPIO_EXPANDER_GPIO_BASE = NR_MSM_GPIOS,
+ /* SURF expander */
+ GPIO_CORE_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
+ GPIO_BT_SYS_REST_EN = GPIO_CORE_EXPANDER_BASE,
+ GPIO_WLAN_EXT_POR_N,
+ GPIO_DISPLAY_PWR_EN,
+ GPIO_BACKLIGHT_EN,
+ GPIO_PRESSURE_XCLR,
+ GPIO_VREG_S3_EXP,
+ GPIO_UBM2M_PWRDWN,
+ GPIO_ETM_MODE_CS_N,
+ GPIO_HOST_VBUS_EN,
+ GPIO_SPI_MOSI,
+ GPIO_SPI_MISO,
+ GPIO_SPI_CLK,
+ GPIO_SPI_CS0_N,
+ GPIO_CORE_EXPANDER_IO13,
+ GPIO_CORE_EXPANDER_IO14,
+ GPIO_CORE_EXPANDER_IO15,
+ /* Camera expander */
+ GPIO_CAM_EXPANDER_BASE = GPIO_CORE_EXPANDER_BASE + 16,
+ GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
+ GPIO_CAM_GP_AFBUSY,
+ GPIO_CAM_GP_CAM_PWDN,
+ GPIO_CAM_GP_CAM1MP_XCLR,
+ GPIO_CAM_GP_CAMIF_RESET_N,
+ GPIO_CAM_GP_STROBE_CE,
+ GPIO_CAM_GP_LED_EN1,
+ GPIO_CAM_GP_LED_EN2,
+};
+
#if defined(CONFIG_GPIO_SX150X)
enum {
SX150X_CORE,
@@ -96,11 +129,22 @@
I2C_BOARD_INFO("sx1509q", 0x3e),
},
};
+static struct i2c_board_info cam_exp_i2c_info[] __initdata = {
+ {
+ I2C_BOARD_INFO("sx1508q", 0x22),
+ .platform_data = &sx150x_data[SX150X_CAM],
+ },
+};
#endif
#if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X)
static void __init register_i2c_devices(void)
{
+
+ i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
+ cam_exp_i2c_info,
+ ARRAY_SIZE(cam_exp_i2c_info));
+
if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf())
sx150x_data[SX150X_CORE].io_open_drain_ena = 0xe0f0;
@@ -910,6 +954,311 @@
gpio_set_value(ETH_FIFO_SEL_GPIO, 0);
}
+#ifdef CONFIG_MSM_CAMERA
+static uint32_t camera_off_gpio_table[] = {
+ GPIO_CFG(15, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
+};
+
+static uint32_t camera_on_gpio_table[] = {
+ GPIO_CFG(15, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
+};
+
+#ifdef CONFIG_MSM_CAMERA_FLASH
+static struct msm_camera_sensor_flash_src msm_flash_src = {
+ .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
+ ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
+ ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
+};
+#endif
+
+static struct regulator_bulk_data regs_camera[] = {
+ { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
+ { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
+ { .supply = "usb2", .min_uV = 1800000, .max_uV = 1800000 },
+};
+
+static void __init msm_camera_vreg_init(void)
+{
+ int rc;
+
+ rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_camera), regs_camera);
+
+ if (rc) {
+ pr_err("%s: could not get regulators: %d\n", __func__, rc);
+ return;
+ }
+
+ rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera), regs_camera);
+
+ if (rc) {
+ pr_err("%s: could not set voltages: %d\n", __func__, rc);
+ return;
+ }
+}
+
+static void msm_camera_vreg_config(int vreg_en)
+{
+ int rc = vreg_en ?
+ regulator_bulk_enable(ARRAY_SIZE(regs_camera), regs_camera) :
+ regulator_bulk_disable(ARRAY_SIZE(regs_camera), regs_camera);
+
+ if (rc)
+ pr_err("%s: could not %sable regulators: %d\n",
+ __func__, vreg_en ? "en" : "dis", rc);
+}
+
+static int config_gpio_table(uint32_t *table, int len)
+{
+ int rc = 0, i = 0;
+
+ for (i = 0; i < len; i++) {
+ rc = gpio_tlmm_config(table[i], GPIO_CFG_ENABLE);
+ if (rc) {
+ pr_err("%s not able to get gpio\n", __func__);
+ for (i--; i >= 0; i--)
+ gpio_tlmm_config(camera_off_gpio_table[i],
+ GPIO_CFG_ENABLE);
+ break;
+ }
+ }
+ return rc;
+}
+
+static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data;
+static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data;
+static int config_camera_on_gpios_rear(void)
+{
+ int rc = 0;
+
+ if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
+ msm_camera_vreg_config(1);
+
+ rc = config_gpio_table(camera_on_gpio_table,
+ ARRAY_SIZE(camera_on_gpio_table));
+ if (rc < 0) {
+ pr_err("%s: CAMSENSOR gpio table request"
+ "failed\n", __func__);
+ return rc;
+ }
+
+ return rc;
+}
+
+static void config_camera_off_gpios_rear(void)
+{
+ if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
+ msm_camera_vreg_config(0);
+
+ config_gpio_table(camera_off_gpio_table,
+ ARRAY_SIZE(camera_off_gpio_table));
+}
+
+static int config_camera_on_gpios_front(void)
+{
+ int rc = 0;
+
+ if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
+ msm_camera_vreg_config(1);
+
+ rc = config_gpio_table(camera_on_gpio_table,
+ ARRAY_SIZE(camera_on_gpio_table));
+ if (rc < 0) {
+ pr_err("%s: CAMSENSOR gpio table request"
+ "failed\n", __func__);
+ return rc;
+ }
+
+ return rc;
+}
+
+static void config_camera_off_gpios_front(void)
+{
+ if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
+ msm_camera_vreg_config(0);
+
+ config_gpio_table(camera_off_gpio_table,
+ ARRAY_SIZE(camera_off_gpio_table));
+}
+
+struct msm_camera_device_platform_data msm_camera_device_data_rear = {
+ .camera_gpio_on = config_camera_on_gpios_rear,
+ .camera_gpio_off = config_camera_off_gpios_rear,
+ .ioext.csiphy = 0xA1000000,
+ .ioext.csisz = 0x00100000,
+ .ioext.csiirq = INT_CSI_IRQ_1,
+ .ioclk.mclk_clk_rate = 24000000,
+ .ioclk.vfe_clk_rate = 192000000,
+ .ioext.appphy = MSM_CLK_CTL_PHYS,
+ .ioext.appsz = MSM_CLK_CTL_SIZE,
+};
+
+struct msm_camera_device_platform_data msm_camera_device_data_front = {
+ .camera_gpio_on = config_camera_on_gpios_front,
+ .camera_gpio_off = config_camera_off_gpios_front,
+ .ioext.csiphy = 0xA0F00000,
+ .ioext.csisz = 0x00100000,
+ .ioext.csiirq = INT_CSI_IRQ_0,
+ .ioclk.mclk_clk_rate = 24000000,
+ .ioclk.vfe_clk_rate = 192000000,
+ .ioext.appphy = MSM_CLK_CTL_PHYS,
+ .ioext.appsz = MSM_CLK_CTL_SIZE,
+};
+
+#ifdef CONFIG_S5K4E1
+static struct msm_camera_sensor_platform_info s5k4e1_sensor_7627a_info = {
+ .mount_angle = 90
+};
+
+static struct msm_camera_sensor_flash_data flash_s5k4e1 = {
+ .flash_type = MSM_CAMERA_FLASH_LED,
+ .flash_src = &msm_flash_src
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data = {
+ .sensor_name = "s5k4e1",
+ .sensor_reset_enable = 1,
+ .sensor_reset = GPIO_CAM_GP_CAMIF_RESET_N,
+ .sensor_pwd = 85,
+ .vcm_pwd = GPIO_CAM_GP_CAM_PWDN,
+ .vcm_enable = 1,
+ .pdata = &msm_camera_device_data_rear,
+ .flash_data = &flash_s5k4e1,
+ .sensor_platform_info = &s5k4e1_sensor_7627a_info,
+ .csi_if = 1
+};
+
+static struct platform_device msm_camera_sensor_s5k4e1 = {
+ .name = "msm_camera_s5k4e1",
+ .dev = {
+ .platform_data = &msm_camera_sensor_s5k4e1_data,
+ },
+};
+#endif
+
+#ifdef CONFIG_IMX072
+static struct msm_camera_sensor_platform_info imx072_sensor_7627a_info = {
+ .mount_angle = 90
+};
+
+static struct msm_camera_sensor_flash_data flash_imx072 = {
+ .flash_type = MSM_CAMERA_FLASH_LED,
+ .flash_src = &msm_flash_src
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_imx072_data = {
+ .sensor_name = "imx072",
+ .sensor_reset_enable = 1,
+ .sensor_reset = GPIO_CAM_GP_CAMIF_RESET_N, /* TODO 106,*/
+ .sensor_pwd = 85,
+ .vcm_pwd = GPIO_CAM_GP_CAM_PWDN,
+ .vcm_enable = 1,
+ .pdata = &msm_camera_device_data_rear,
+ .flash_data = &flash_imx072,
+ .sensor_platform_info = &imx072_sensor_7627a_info,
+ .csi_if = 1
+};
+
+static struct platform_device msm_camera_sensor_imx072 = {
+ .name = "msm_camera_imx072",
+ .dev = {
+ .platform_data = &msm_camera_sensor_imx072_data,
+ },
+};
+#endif
+
+#ifdef CONFIG_WEBCAM_OV9726
+static struct msm_camera_sensor_platform_info ov9726_sensor_7627a_info = {
+ .mount_angle = 90
+};
+
+static struct msm_camera_sensor_flash_data flash_ov9726 = {
+ .flash_type = MSM_CAMERA_FLASH_NONE,
+ .flash_src = &msm_flash_src
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data = {
+ .sensor_name = "ov9726",
+ .sensor_reset_enable = 0,
+ .sensor_reset = GPIO_CAM_GP_CAM1MP_XCLR,
+ .sensor_pwd = 85,
+ .vcm_pwd = 1,
+ .vcm_enable = 0,
+ .pdata = &msm_camera_device_data_front,
+ .flash_data = &flash_ov9726,
+ .sensor_platform_info = &ov9726_sensor_7627a_info,
+ .csi_if = 1
+};
+
+static struct platform_device msm_camera_sensor_ov9726 = {
+ .name = "msm_camera_ov9726",
+ .dev = {
+ .platform_data = &msm_camera_sensor_ov9726_data,
+ },
+};
+#else
+static inline void msm_camera_vreg_init(void) { }
+#endif
+
+#ifdef CONFIG_MT9E013
+static struct msm_camera_sensor_platform_info mt9e013_sensor_7627a_info = {
+ .mount_angle = 90
+};
+
+static struct msm_camera_sensor_flash_data flash_mt9e013 = {
+ .flash_type = MSM_CAMERA_FLASH_LED,
+ .flash_src = &msm_flash_src
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_mt9e013_data = {
+ .sensor_name = "mt9e013",
+ .sensor_reset = 0,
+ .sensor_reset_enable = 1,
+ .sensor_pwd = 85,
+ .vcm_pwd = 1,
+ .vcm_enable = 0,
+ .pdata = &msm_camera_device_data_rear,
+ .flash_data = &flash_mt9e013,
+ .sensor_platform_info = &mt9e013_sensor_7627a_info,
+ .csi_if = 1
+};
+
+static struct platform_device msm_camera_sensor_mt9e013 = {
+ .name = "msm_camera_mt9e013",
+ .dev = {
+ .platform_data = &msm_camera_sensor_mt9e013_data,
+ },
+};
+#endif
+
+static struct i2c_board_info i2c_camera_devices[] = {
+ #ifdef CONFIG_S5K4E1
+ {
+ I2C_BOARD_INFO("s5k4e1", 0x36),
+ },
+ {
+ I2C_BOARD_INFO("s5k4e1_af", 0x8c >> 1),
+ },
+ #endif
+ #ifdef CONFIG_WEBCAM_OV9726
+ {
+ I2C_BOARD_INFO("ov9726", 0x10),
+ },
+ #endif
+ #ifdef CONFIG_IMX072
+ {
+ I2C_BOARD_INFO("imx072", 0x34),
+ },
+ #endif
+ #ifdef CONFIG_MT9E013
+ {
+ I2C_BOARD_INFO("mt9e013", 0x6C >> 2),
+ },
+ #endif
+ {
+ I2C_BOARD_INFO("sc628a", 0x6E),
+ },
+};
+#endif
#if defined(CONFIG_SERIAL_MSM_HSL_CONSOLE) \
&& defined(CONFIG_MSM_SHARED_GPIO_FOR_UART2DM)
static struct msm_gpio uart2dm_gpios[] = {
@@ -967,6 +1316,18 @@
&lcdc_toshiba_panel_device,
&msm_batt_device,
&smsc911x_device,
+#ifdef CONFIG_S5K4E1
+ &msm_camera_sensor_s5k4e1,
+#endif
+#ifdef CONFIG_IMX072
+ &msm_camera_sensor_imx072,
+#endif
+#ifdef CONFIG_WEBCAM_OV9726
+ &msm_camera_sensor_ov9726,
+#endif
+#ifdef CONFIG_MT9E013
+ &msm_camera_sensor_mt9e013,
+#endif
#ifdef CONFIG_FB_MSM_MIPI_DSI
&mipi_dsi_renesas_panel_device,
#endif
@@ -1668,6 +2029,9 @@
#if defined(CONFIG_MSM_CAMERA)
msm_camera_vreg_init();
+ i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
+ i2c_camera_devices,
+ ARRAY_SIZE(i2c_camera_devices));
#endif
platform_device_register(&kp_pdev);
platform_device_register(&hs_pdev);
diff --git a/arch/arm/mach-msm/board-qrd7627a.c b/arch/arm/mach-msm/board-qrd7627a.c
index cc5af6a..08ec05e 100644
--- a/arch/arm/mach-msm/board-qrd7627a.c
+++ b/arch/arm/mach-msm/board-qrd7627a.c
@@ -68,6 +68,20 @@
#define I2C_PIN_CTL 0x15
#define I2C_NORMAL 0x40
+enum {
+ GPIO_HOST_VBUS_EN = 107,
+ GPIO_BT_SYS_REST_EN = 114,
+ GPIO_WAKE_ON_WIRELESS,
+ GPIO_BACKLIGHT_EN,
+ GPIO_NC,
+ GPIO_CAM_3MP_PWDN, /* CAM_VGA */
+ GPIO_WLAN_EN,
+ GPIO_CAM_5MP_SHDN_EN,
+ GPIO_CAM_5MP_RESET,
+ GPIO_TP,
+ GPIO_CAM_GP_CAMIF_RESET,
+};
+
static struct platform_device msm_wlan_ar6000_pm_device = {
.name = "wlan_ar6000_pm_dev",
.id = -1,
@@ -281,7 +295,7 @@
int rc = 0;
unsigned gpio;
- gpio = QRD_GPIO_HOST_VBUS_EN;
+ gpio = GPIO_HOST_VBUS_EN;
rc = gpio_request(gpio, "i2c_host_vbus_en");
if (rc < 0) {
@@ -504,7 +518,7 @@
static int mipi_truly_set_bl(int on)
{
- gpio_set_value_cansleep(QRD_GPIO_BACKLIGHT_EN, !!on);
+ gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, !!on);
return 1;
}
@@ -726,6 +740,275 @@
.dev.platform_data = &msm_psy_batt_data,
};
+#ifdef CONFIG_MSM_CAMERA
+static uint32_t camera_off_gpio_table[] = {
+ GPIO_CFG(15, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
+};
+
+static uint32_t camera_on_gpio_table[] = {
+ GPIO_CFG(15, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
+};
+
+static void qrd1_camera_gpio_cfg(void)
+{
+
+ int rc = 0;
+
+ rc = gpio_request(GPIO_CAM_5MP_SHDN_EN, "ov5640");
+ if (rc < 0)
+ pr_err("%s: gpio_request---GPIO_CAM_5MP_SHDN_EN failed!",
+ __func__);
+
+
+ rc = gpio_tlmm_config(GPIO_CFG(GPIO_CAM_5MP_SHDN_EN, 0,
+ GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
+ GPIO_CFG_2MA), GPIO_CFG_ENABLE);
+ if (rc < 0) {
+ pr_err("%s: unable to enable Power Down gpio for main"
+ "camera!\n", __func__);
+ gpio_free(GPIO_CAM_5MP_SHDN_EN);
+ }
+
+
+ rc = gpio_request(GPIO_CAM_5MP_RESET, "ov5640");
+ if (rc < 0) {
+ pr_err("%s: gpio_request---GPIO_CAM_5MP_RESET failed!",
+ __func__);
+ gpio_free(GPIO_CAM_5MP_SHDN_EN);
+ }
+
+
+ rc = gpio_tlmm_config(GPIO_CFG(GPIO_CAM_5MP_RESET, 0,
+ GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
+ GPIO_CFG_2MA), GPIO_CFG_ENABLE);
+ if (rc < 0) {
+ pr_err("%s: unable to enable reset gpio for main camera!\n",
+ __func__);
+ gpio_free(GPIO_CAM_5MP_RESET);
+ }
+
+ rc = gpio_request(GPIO_CAM_3MP_PWDN, "ov7692");
+ if (rc < 0)
+ pr_err("%s: gpio_request---GPIO_CAM_3MP_PWDN failed!",
+ __func__);
+
+ rc = gpio_tlmm_config(GPIO_CFG(GPIO_CAM_3MP_PWDN, 0,
+ GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
+ GPIO_CFG_2MA), GPIO_CFG_ENABLE);
+ if (rc < 0) {
+ pr_err("%s: unable to enable Power Down gpio for front"
+ "camera!\n", __func__);
+ gpio_free(GPIO_CAM_3MP_PWDN);
+ }
+
+ gpio_direction_output(GPIO_CAM_5MP_SHDN_EN, 1);
+ gpio_direction_output(GPIO_CAM_5MP_RESET, 1);
+ gpio_direction_output(GPIO_CAM_3MP_PWDN, 1);
+}
+
+#endif
+static struct regulator_bulk_data regs_camera[] = {
+ { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
+ { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
+ { .supply = "usb2", .min_uV = 1800000, .max_uV = 1800000 },
+};
+
+static void __init msm_camera_vreg_init(void)
+{
+ int rc;
+
+ rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_camera), regs_camera);
+ if (rc) {
+ pr_err("%s: could not get regulators: %d\n", __func__, rc);
+ return;
+ }
+
+ rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera), regs_camera);
+ if (rc) {
+ pr_err("%s: could not set voltages: %d\n", __func__, rc);
+ return;
+ }
+}
+
+static void msm_camera_vreg_config(int vreg_en)
+{
+ int rc = vreg_en ?
+ regulator_bulk_enable(ARRAY_SIZE(regs_camera), regs_camera) :
+ regulator_bulk_disable(ARRAY_SIZE(regs_camera), regs_camera);
+
+ if (rc)
+ pr_err("%s: could not %sable regulators: %d\n",
+ __func__, vreg_en ? "en" : "dis", rc);
+}
+static int config_gpio_table(uint32_t *table, int len)
+{
+ int rc = 0, i = 0;
+
+ for (i = 0; i < len; i++) {
+ rc = gpio_tlmm_config(table[i], GPIO_CFG_ENABLE);
+ if (rc) {
+ pr_err("%s not able to get gpio\n", __func__);
+ for (i--; i >= 0; i--)
+ gpio_tlmm_config(camera_off_gpio_table[i],
+ GPIO_CFG_ENABLE);
+ break;
+ }
+ }
+ return rc;
+}
+
+static int config_camera_on_gpios_rear(void)
+{
+ int rc = 0;
+
+ msm_camera_vreg_config(1);
+
+ rc = config_gpio_table(camera_on_gpio_table,
+ ARRAY_SIZE(camera_on_gpio_table));
+ if (rc < 0) {
+ pr_err("%s: CAMSENSOR gpio table request"
+ "failed\n", __func__);
+ return rc;
+ }
+
+ return rc;
+}
+
+static void config_camera_off_gpios_rear(void)
+{
+ msm_camera_vreg_config(0);
+ config_gpio_table(camera_off_gpio_table,
+ ARRAY_SIZE(camera_off_gpio_table));
+}
+
+static int config_camera_on_gpios_front(void)
+{
+ int rc = 0;
+
+ msm_camera_vreg_config(1);
+
+ rc = config_gpio_table(camera_on_gpio_table,
+ ARRAY_SIZE(camera_on_gpio_table));
+ if (rc < 0) {
+ pr_err("%s: CAMSENSOR gpio table request"
+ "failed\n", __func__);
+ return rc;
+ }
+
+ return rc;
+}
+
+static void config_camera_off_gpios_front(void)
+{
+ msm_camera_vreg_config(0);
+
+ config_gpio_table(camera_off_gpio_table,
+ ARRAY_SIZE(camera_off_gpio_table));
+}
+
+struct msm_camera_device_platform_data msm_camera_data_rear = {
+ .camera_gpio_on = config_camera_on_gpios_rear,
+ .camera_gpio_off = config_camera_off_gpios_rear,
+ .ioext.csiphy = 0xA1000000,
+ .ioext.csisz = 0x00100000,
+ .ioext.csiirq = INT_CSI_IRQ_1,
+ .ioclk.mclk_clk_rate = 24000000,
+ .ioclk.vfe_clk_rate = 192000000,
+ .ioext.appphy = MSM_CLK_CTL_PHYS,
+ .ioext.appsz = MSM_CLK_CTL_SIZE,
+};
+
+struct msm_camera_device_platform_data msm_camera_data_front = {
+ .camera_gpio_on = config_camera_on_gpios_front,
+ .camera_gpio_off = config_camera_off_gpios_front,
+ .ioext.csiphy = 0xA0F00000,
+ .ioext.csisz = 0x00100000,
+ .ioext.csiirq = INT_CSI_IRQ_0,
+ .ioclk.mclk_clk_rate = 24000000,
+ .ioclk.vfe_clk_rate = 192000000,
+ .ioext.appphy = MSM_CLK_CTL_PHYS,
+ .ioext.appsz = MSM_CLK_CTL_SIZE,
+};
+
+#ifdef CONFIG_OV5640
+static struct msm_camera_sensor_platform_info ov5640_sensor_info = {
+ .mount_angle = 90
+};
+
+static struct msm_camera_sensor_flash_src msm_flash_src_ov5640 = {
+ .flash_sr_type = MSM_CAMERA_FLASH_SRC_LED,
+ ._fsrc.led_src.led_name = "flashlight",
+ ._fsrc.led_src.led_name_len = 10,
+};
+
+static struct msm_camera_sensor_flash_data flash_ov5640 = {
+ .flash_type = MSM_CAMERA_FLASH_LED,
+ .flash_src = &msm_flash_src_ov5640,
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_ov5640_data = {
+ .sensor_name = "ov5640",
+ .sensor_reset_enable = 1,
+ .sensor_reset = GPIO_CAM_5MP_RESET,
+ .sensor_pwd = GPIO_CAM_5MP_SHDN_EN,
+ .vcm_pwd = 0,
+ .vcm_enable = 0,
+ .pdata = &msm_camera_data_rear,
+ .flash_data = &flash_ov5640,
+ .sensor_platform_info = &ov5640_sensor_info,
+ .csi_if = 1,
+};
+
+static struct platform_device msm_camera_sensor_ov5640 = {
+ .name = "msm_camera_ov5640",
+ .dev = {
+ .platform_data = &msm_camera_sensor_ov5640_data,
+ },
+};
+#endif
+
+#ifdef CONFIG_WEBCAM_OV7692_QRD
+static struct msm_camera_sensor_platform_info ov7692_sensor_7627a_info = {
+ .mount_angle = 90
+};
+
+static struct msm_camera_sensor_flash_data flash_ov7692 = {
+ .flash_type = MSM_CAMERA_FLASH_NONE,
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_ov7692_data = {
+ .sensor_name = "ov7692",
+ .sensor_reset_enable = 0,
+ .sensor_reset = 0,
+ .sensor_pwd = GPIO_CAM_3MP_PWDN,
+ .vcm_pwd = 0,
+ .vcm_enable = 0,
+ .pdata = &msm_camera_data_front,
+ .flash_data = &flash_ov7692,
+ .sensor_platform_info = &ov7692_sensor_7627a_info,
+ .csi_if = 1,
+};
+
+static struct platform_device msm_camera_sensor_ov7692 = {
+ .name = "msm_camera_ov7692",
+ .dev = {
+ .platform_data = &msm_camera_sensor_ov7692_data,
+ },
+};
+#endif
+
+static struct i2c_board_info i2c_camera_devices[] = {
+ #ifdef CONFIG_OV5640
+ {
+ I2C_BOARD_INFO("ov5640", 0x78 >> 1),
+ },
+ #endif
+ #ifdef CONFIG_WEBCAM_OV7692_QRD
+ {
+ I2C_BOARD_INFO("ov7692", 0x78),
+ },
+ #endif
+};
static struct platform_device *qrd1_devices[] __initdata = {
&msm_device_dmov,
&msm_device_smd,
@@ -743,6 +1026,12 @@
&msm_device_snd,
&msm_device_adspdec,
&msm_batt_device,
+#ifdef CONFIG_OV5640
+ &msm_camera_sensor_ov5640,
+#endif
+#ifdef CONFIG_WEBCAM_OV7692_QRD
+ &msm_camera_sensor_ov7692,
+#endif
&msm_kgsl_3d0,
#ifdef CONFIG_BT
&msm_bt_power_device,
@@ -895,11 +1184,11 @@
int rc = 0;
if (!dsi_gpio_initialized) {
- rc = gpio_request(QRD_GPIO_BACKLIGHT_EN, "gpio_bkl_en");
+ rc = gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en");
if (rc < 0)
return rc;
- rc = gpio_tlmm_config(GPIO_CFG(QRD_GPIO_BACKLIGHT_EN, 0,
+ rc = gpio_tlmm_config(GPIO_CFG(GPIO_BACKLIGHT_EN, 0,
GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
GPIO_CFG_ENABLE);
if (rc < 0) {
@@ -907,16 +1196,16 @@
return rc;
}
- rc = gpio_direction_output(QRD_GPIO_BACKLIGHT_EN, 1);
+ rc = gpio_direction_output(GPIO_BACKLIGHT_EN, 1);
if (rc < 0) {
pr_err("failed to enable backlight\n");
- gpio_free(QRD_GPIO_BACKLIGHT_EN);
+ gpio_free(GPIO_BACKLIGHT_EN);
return rc;
}
dsi_gpio_initialized = 1;
}
- gpio_set_value_cansleep(QRD_GPIO_BACKLIGHT_EN, !!on);
+ gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, !!on);
if (!on) {
gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1);
@@ -1074,6 +1363,8 @@
#endif
msm_camera_vreg_init();
+ i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID, i2c_camera_devices,
+ ARRAY_SIZE(i2c_camera_devices));
#if defined(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C) || \
defined(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C_MODULE)
diff --git a/arch/arm/mach-msm/pmic8058-gpio.c b/arch/arm/mach-msm/pmic8058-gpio.c
deleted file mode 100644
index 63a26de..0000000
--- a/arch/arm/mach-msm/pmic8058-gpio.c
+++ /dev/null
@@ -1,705 +0,0 @@
-/* Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * 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.
- */
-/*
- * Qualcomm PMIC8058 GPIO driver
- *
- */
-
-#include <linux/platform_device.h>
-#include <linux/gpio.h>
-#include <linux/mfd/pmic8058.h>
-#include <linux/debugfs.h>
-#include <linux/uaccess.h>
-#include <linux/fs.h>
-#include <linux/seq_file.h>
-
-#ifndef CONFIG_GPIOLIB
-#include "gpio_chip.h"
-#endif
-
-/* GPIO registers */
-#define SSBI_REG_ADDR_GPIO_BASE 0x150
-#define SSBI_REG_ADDR_GPIO(n) (SSBI_REG_ADDR_GPIO_BASE + n)
-
-/* GPIO */
-#define PM8058_GPIO_BANK_MASK 0x70
-#define PM8058_GPIO_BANK_SHIFT 4
-#define PM8058_GPIO_WRITE 0x80
-
-/* Bank 0 */
-#define PM8058_GPIO_VIN_MASK 0x0E
-#define PM8058_GPIO_VIN_SHIFT 1
-#define PM8058_GPIO_MODE_ENABLE 0x01
-
-/* Bank 1 */
-#define PM8058_GPIO_MODE_MASK 0x0C
-#define PM8058_GPIO_MODE_SHIFT 2
-#define PM8058_GPIO_OUT_BUFFER 0x02
-#define PM8058_GPIO_OUT_INVERT 0x01
-
-#define PM8058_GPIO_MODE_OFF 3
-#define PM8058_GPIO_MODE_OUTPUT 2
-#define PM8058_GPIO_MODE_INPUT 0
-#define PM8058_GPIO_MODE_BOTH 1
-
-/* Bank 2 */
-#define PM8058_GPIO_PULL_MASK 0x0E
-#define PM8058_GPIO_PULL_SHIFT 1
-
-/* Bank 3 */
-#define PM8058_GPIO_OUT_STRENGTH_MASK 0x0C
-#define PM8058_GPIO_OUT_STRENGTH_SHIFT 2
-#define PM8058_GPIO_PIN_ENABLE 0x00
-#define PM8058_GPIO_PIN_DISABLE 0x01
-
-/* Bank 4 */
-#define PM8058_GPIO_FUNC_MASK 0x0E
-#define PM8058_GPIO_FUNC_SHIFT 1
-
-/* Bank 5 */
-#define PM8058_GPIO_NON_INT_POL_INV 0x08
-#define PM8058_GPIO_BANKS 6
-
-struct pm8058_gpio_chip {
- struct gpio_chip gpio_chip;
- struct pm8058_chip *pm_chip;
- struct mutex pm_lock;
- u8 bank1[PM8058_GPIOS];
-};
-
-static int pm8058_gpio_get(struct pm8058_gpio_chip *chip, unsigned gpio)
-{
- struct pm8058_gpio_platform_data *pdata;
- int mode;
-
- if (gpio >= PM8058_GPIOS || chip == NULL)
- return -EINVAL;
-
- pdata = chip->gpio_chip.dev->platform_data;
-
- /* Get gpio value from config bank 1 if output gpio.
- Get gpio value from IRQ RT status register for all other gpio modes.
- */
- mode = (chip->bank1[gpio] & PM8058_GPIO_MODE_MASK) >>
- PM8058_GPIO_MODE_SHIFT;
- if (mode == PM8058_GPIO_MODE_OUTPUT)
- return chip->bank1[gpio] & PM8058_GPIO_OUT_INVERT;
- else
- return pm8058_irq_get_rt_status(chip->pm_chip,
- pdata->irq_base + gpio);
-}
-
-static int pm8058_gpio_set(struct pm8058_gpio_chip *chip,
- unsigned gpio, int value)
-{
- int rc;
- u8 bank1;
-
- if (gpio >= PM8058_GPIOS || chip == NULL)
- return -EINVAL;
-
- mutex_lock(&chip->pm_lock);
- bank1 = chip->bank1[gpio] & ~PM8058_GPIO_OUT_INVERT;
-
- if (value)
- bank1 |= PM8058_GPIO_OUT_INVERT;
-
- chip->bank1[gpio] = bank1;
- rc = pm8058_write(chip->pm_chip, SSBI_REG_ADDR_GPIO(gpio), &bank1, 1);
- mutex_unlock(&chip->pm_lock);
-
- if (rc)
- pr_err("%s: FAIL pm8058_write(): rc=%d. "
- "(gpio=%d, value=%d)\n",
- __func__, rc, gpio, value);
-
- return rc;
-}
-
-static int pm8058_gpio_set_direction(struct pm8058_gpio_chip *chip,
- unsigned gpio, int direction)
-{
- int rc;
- u8 bank1;
- static int dir_map[] = {
- PM8058_GPIO_MODE_OFF,
- PM8058_GPIO_MODE_OUTPUT,
- PM8058_GPIO_MODE_INPUT,
- PM8058_GPIO_MODE_BOTH,
- };
-
- if (!direction || chip == NULL)
- return -EINVAL;
-
- mutex_lock(&chip->pm_lock);
- bank1 = chip->bank1[gpio] & ~PM8058_GPIO_MODE_MASK;
-
- bank1 |= ((dir_map[direction] << PM8058_GPIO_MODE_SHIFT)
- & PM8058_GPIO_MODE_MASK);
-
- chip->bank1[gpio] = bank1;
- rc = pm8058_write(chip->pm_chip, SSBI_REG_ADDR_GPIO(gpio), &bank1, 1);
- mutex_unlock(&chip->pm_lock);
-
- if (rc)
- pr_err("%s: Failed on pm8058_write(): rc=%d (GPIO config)\n",
- __func__, rc);
-
- return rc;
-}
-
-static int pm8058_gpio_init_bank1(struct pm8058_gpio_chip *chip)
-{
- int i, rc;
- u8 bank;
-
- for (i = 0; i < PM8058_GPIOS; i++) {
- bank = 1 << PM8058_GPIO_BANK_SHIFT;
- rc = pm8058_write(chip->pm_chip,
- SSBI_REG_ADDR_GPIO(i),
- &bank, 1);
- if (rc) {
- pr_err("%s: error setting bank\n", __func__);
- return rc;
- }
-
- rc = pm8058_read(chip->pm_chip,
- SSBI_REG_ADDR_GPIO(i),
- &chip->bank1[i], 1);
- if (rc) {
- pr_err("%s: error reading bank 1\n", __func__);
- return rc;
- }
- }
- return 0;
-}
-
-#ifndef CONFIG_GPIOLIB
-static int pm8058_gpio_configure(struct gpio_chip *chip,
- unsigned int gpio,
- unsigned long flags)
-{
- int rc = 0, direction;
- struct pm8058_gpio_chip *gpio_chip;
-
- gpio -= chip->start;
-
- if (flags & (GPIOF_INPUT | GPIOF_DRIVE_OUTPUT)) {
- direction = 0;
- if (flags & GPIOF_INPUT)
- direction |= PM_GPIO_DIR_IN;
- if (flags & GPIOF_DRIVE_OUTPUT)
- direction |= PM_GPIO_DIR_OUT;
-
- gpio_chip = dev_get_drvdata(chip->dev);
-
- if (flags & (GPIOF_OUTPUT_LOW | GPIOF_OUTPUT_HIGH)) {
- if (flags & GPIOF_OUTPUT_HIGH)
- rc = pm8058_gpio_set(gpio_chip,
- gpio, 1);
- else
- rc = pm8058_gpio_set(gpio_chip,
- gpio, 0);
-
- if (rc) {
- pr_err("%s: FAIL pm8058_gpio_set(): rc=%d.\n",
- __func__, rc);
- goto bail_out;
- }
- }
-
- rc = pm8058_gpio_set_direction(gpio_chip,
- gpio, direction);
- if (rc)
- pr_err("%s: FAIL pm8058_gpio_config(): rc=%d.\n",
- __func__, rc);
- }
-
-bail_out:
- return rc;
-}
-
-static int pm8058_gpio_get_irq_num(struct gpio_chip *chip,
- unsigned int gpio,
- unsigned int *irqp,
- unsigned long *irqnumflagsp)
-{
- struct pm8058_gpio_platform_data *pdata;
-
- pdata = chip->dev->platform_data;
- gpio -= chip->start;
- *irqp = pdata->irq_base + gpio;
- if (irqnumflagsp)
- *irqnumflagsp = 0;
- return 0;
-}
-
-static int pm8058_gpio_read(struct gpio_chip *chip, unsigned n)
-{
- struct pm8058_gpio_chip *gpio_chip;
-
- n -= chip->start;
- gpio_chip = dev_get_drvdata(chip->dev);
- return pm8058_gpio_get(gpio_chip, n);
-}
-
-static int pm8058_gpio_write(struct gpio_chip *chip, unsigned n, unsigned on)
-{
- struct pm8058_gpio_chip *gpio_chip;
-
- n -= chip->start;
- gpio_chip = dev_get_drvdata(chip->dev);
- return pm8058_gpio_set(gpio_chip, n, on);
-}
-
-static struct pm8058_gpio_chip pm8058_gpio_chip = {
- .gpio_chip = {
- .configure = pm8058_gpio_configure,
- .get_irq_num = pm8058_gpio_get_irq_num,
- .read = pm8058_gpio_read,
- .write = pm8058_gpio_write,
- },
-};
-
-static int __devinit pm8058_gpio_probe(struct platform_device *pdev)
-{
- int rc = 0;
- struct pm8058_gpio_platform_data *pdata = pdev->dev.platform_data;
-
- mutex_init(&pm8058_gpio_chip.pm_lock);
- pm8058_gpio_chip.gpio_chip.dev = &pdev->dev;
- pm8058_gpio_chip.gpio_chip.start = pdata->gpio_base;
- pm8058_gpio_chip.gpio_chip.end = pdata->gpio_base +
- PM8058_GPIOS - 1;
- pm8058_gpio_chip.pm_chip = platform_get_drvdata(pdev);
- platform_set_drvdata(pdev, &pm8058_gpio_chip);
-
- rc = register_gpio_chip(&pm8058_gpio_chip.gpio_chip);
- if (!rc)
- goto bail;
-
- rc = pm8058_gpio_init_bank1(&pm8058_gpio_chip);
- if (rc)
- goto bail;
-
- if (pdata->init)
- rc = pdata->init();
-
-bail:
- if (rc)
- platform_set_drvdata(pdev, pm8058_gpio_chip.pm_chip);
-
- pr_info("%s: register_gpio_chip(): rc=%d\n", __func__, rc);
- return rc;
-}
-
-static int __devexit pm8058_gpio_remove(struct platform_device *pdev)
-{
- return 0;
-}
-
-#else
-
-static int pm8058_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
-{
- struct pm8058_gpio_platform_data *pdata;
- pdata = chip->dev->platform_data;
- return pdata->irq_base + offset;
-}
-
-static int pm8058_gpio_read(struct gpio_chip *chip, unsigned offset)
-{
- struct pm8058_gpio_chip *gpio_chip;
- gpio_chip = dev_get_drvdata(chip->dev);
- return pm8058_gpio_get(gpio_chip, offset);
-}
-
-static void pm8058_gpio_write(struct gpio_chip *chip,
- unsigned offset, int val)
-{
- struct pm8058_gpio_chip *gpio_chip;
- gpio_chip = dev_get_drvdata(chip->dev);
- pm8058_gpio_set(gpio_chip, offset, val);
-}
-
-static int pm8058_gpio_direction_input(struct gpio_chip *chip,
- unsigned offset)
-{
- struct pm8058_gpio_chip *gpio_chip;
- gpio_chip = dev_get_drvdata(chip->dev);
- return pm8058_gpio_set_direction(gpio_chip, offset, PM_GPIO_DIR_IN);
-}
-
-static int pm8058_gpio_direction_output(struct gpio_chip *chip,
- unsigned offset,
- int val)
-{
- struct pm8058_gpio_chip *gpio_chip;
- int ret;
-
- gpio_chip = dev_get_drvdata(chip->dev);
- ret = pm8058_gpio_set_direction(gpio_chip, offset, PM_GPIO_DIR_OUT);
- if (!ret)
- ret = pm8058_gpio_set(gpio_chip, offset, val);
-
- return ret;
-}
-
-static void pm8058_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
-{
- static const char *cmode[] = { "in", "in/out", "out", "off" };
- struct pm8058_gpio_chip *gpio_chip = dev_get_drvdata(chip->dev);
- u8 mode, state, bank;
- const char *label;
- int i, j;
-
- for (i = 0; i < PM8058_GPIOS; i++) {
- label = gpiochip_is_requested(chip, i);
- mode = (gpio_chip->bank1[i] & PM8058_GPIO_MODE_MASK) >>
- PM8058_GPIO_MODE_SHIFT;
- state = pm8058_gpio_get(gpio_chip, i);
- seq_printf(s, "gpio-%-3d (%-12.12s) %-10.10s"
- " %s",
- chip->base + i,
- label ? label : "--",
- cmode[mode],
- state ? "hi" : "lo");
- for (j = 0; j < PM8058_GPIO_BANKS; j++) {
- bank = j << PM8058_GPIO_BANK_SHIFT;
- pm8058_write(gpio_chip->pm_chip,
- SSBI_REG_ADDR_GPIO(i),
- &bank, 1);
- pm8058_read(gpio_chip->pm_chip,
- SSBI_REG_ADDR_GPIO(i),
- &bank, 1);
- seq_printf(s, " 0x%02x", bank);
- }
- seq_printf(s, "\n");
- }
-}
-
-static struct pm8058_gpio_chip pm8058_gpio_chip = {
- .gpio_chip = {
- .label = "pm8058-gpio",
- .direction_input = pm8058_gpio_direction_input,
- .direction_output = pm8058_gpio_direction_output,
- .to_irq = pm8058_gpio_to_irq,
- .get = pm8058_gpio_read,
- .set = pm8058_gpio_write,
- .dbg_show = pm8058_gpio_dbg_show,
- .ngpio = PM8058_GPIOS,
- .can_sleep = 1,
- },
-};
-
-static int __devinit pm8058_gpio_probe(struct platform_device *pdev)
-{
- int ret;
- struct pm8058_gpio_platform_data *pdata = pdev->dev.platform_data;
-
- mutex_init(&pm8058_gpio_chip.pm_lock);
- pm8058_gpio_chip.gpio_chip.dev = &pdev->dev;
- pm8058_gpio_chip.gpio_chip.base = pdata->gpio_base;
- pm8058_gpio_chip.pm_chip = dev_get_drvdata(pdev->dev.parent);
- platform_set_drvdata(pdev, &pm8058_gpio_chip);
-
- ret = gpiochip_add(&pm8058_gpio_chip.gpio_chip);
- if (ret)
- goto unset_drvdata;
-
- ret = pm8058_gpio_init_bank1(&pm8058_gpio_chip);
- if (ret)
- goto remove_chip;
-
- if (pdata->init)
- ret = pdata->init();
- if (!ret)
- goto ok;
-
-remove_chip:
- if (gpiochip_remove(&pm8058_gpio_chip.gpio_chip))
- pr_err("%s: failed to remove gpio chip\n", __func__);
-unset_drvdata:
- platform_set_drvdata(pdev, pm8058_gpio_chip.pm_chip);
-ok:
- pr_info("%s: gpiochip_add(): rc=%d\n", __func__, ret);
-
- return ret;
-}
-
-static int __devexit pm8058_gpio_remove(struct platform_device *pdev)
-{
- return gpiochip_remove(&pm8058_gpio_chip.gpio_chip);
-}
-
-#endif
-
-int pm8058_gpio_config(int gpio, struct pm8058_gpio *param)
-{
- int rc;
- u8 bank[8];
- static int dir_map[] = {
- PM8058_GPIO_MODE_OFF,
- PM8058_GPIO_MODE_OUTPUT,
- PM8058_GPIO_MODE_INPUT,
- PM8058_GPIO_MODE_BOTH,
- };
-
- if (param == NULL)
- return -EINVAL;
-
- /* Select banks and configure the gpio */
- bank[0] = PM8058_GPIO_WRITE |
- ((param->vin_sel << PM8058_GPIO_VIN_SHIFT) &
- PM8058_GPIO_VIN_MASK) |
- PM8058_GPIO_MODE_ENABLE;
- bank[1] = PM8058_GPIO_WRITE |
- ((1 << PM8058_GPIO_BANK_SHIFT) &
- PM8058_GPIO_BANK_MASK) |
- ((dir_map[param->direction] <<
- PM8058_GPIO_MODE_SHIFT) &
- PM8058_GPIO_MODE_MASK) |
- ((param->direction & PM_GPIO_DIR_OUT) ?
- ((param->output_buffer & 1) ?
- PM8058_GPIO_OUT_BUFFER : 0) : 0) |
- ((param->direction & PM_GPIO_DIR_OUT) ?
- param->output_value & 0x01 : 0);
- bank[2] = PM8058_GPIO_WRITE |
- ((2 << PM8058_GPIO_BANK_SHIFT) &
- PM8058_GPIO_BANK_MASK) |
- ((param->pull << PM8058_GPIO_PULL_SHIFT) &
- PM8058_GPIO_PULL_MASK);
- bank[3] = PM8058_GPIO_WRITE |
- ((3 << PM8058_GPIO_BANK_SHIFT) &
- PM8058_GPIO_BANK_MASK) |
- ((param->out_strength <<
- PM8058_GPIO_OUT_STRENGTH_SHIFT) &
- PM8058_GPIO_OUT_STRENGTH_MASK) |
- (param->disable_pin ?
- PM8058_GPIO_PIN_DISABLE : PM8058_GPIO_PIN_ENABLE);
- bank[4] = PM8058_GPIO_WRITE |
- ((4 << PM8058_GPIO_BANK_SHIFT) &
- PM8058_GPIO_BANK_MASK) |
- ((param->function << PM8058_GPIO_FUNC_SHIFT) &
- PM8058_GPIO_FUNC_MASK);
- bank[5] = PM8058_GPIO_WRITE |
- ((5 << PM8058_GPIO_BANK_SHIFT) & PM8058_GPIO_BANK_MASK) |
- (param->inv_int_pol ? 0 : PM8058_GPIO_NON_INT_POL_INV);
-
- mutex_lock(&pm8058_gpio_chip.pm_lock);
- /* Remember bank1 for later use */
- pm8058_gpio_chip.bank1[gpio] = bank[1];
- rc = pm8058_write(pm8058_gpio_chip.pm_chip,
- SSBI_REG_ADDR_GPIO(gpio), bank, 6);
- mutex_unlock(&pm8058_gpio_chip.pm_lock);
-
- if (rc)
- pr_err("%s: Failed on pm8058_write(): rc=%d (GPIO config)\n",
- __func__, rc);
-
- return rc;
-}
-EXPORT_SYMBOL(pm8058_gpio_config);
-
-static struct platform_driver pm8058_gpio_driver = {
- .probe = pm8058_gpio_probe,
- .remove = __devexit_p(pm8058_gpio_remove),
- .driver = {
- .name = "pm8058-gpio",
- .owner = THIS_MODULE,
- },
-};
-
-#if defined(CONFIG_DEBUG_FS)
-
-#define DEBUG_MAX_RW_BUF 128
-#define DEBUG_MAX_FNAME 8
-
-static struct dentry *debug_dent;
-
-static char debug_read_buf[DEBUG_MAX_RW_BUF];
-static char debug_write_buf[DEBUG_MAX_RW_BUF];
-
-static int debug_gpios[PM8058_GPIOS];
-
-static int debug_open(struct inode *inode, struct file *file)
-{
- file->private_data = inode->i_private;
- return 0;
-}
-
-static int debug_read_gpio_bank(int gpio, int bank, u8 *data)
-{
- int rc;
-
- mutex_lock(&pm8058_gpio_chip.pm_lock);
-
- *data = bank << PM8058_GPIO_BANK_SHIFT;
- rc = pm8058_write(pm8058_gpio_chip.pm_chip,
- SSBI_REG_ADDR_GPIO(gpio), data, 1);
- if (rc)
- goto bail_out;
-
- *data = bank << PM8058_GPIO_BANK_SHIFT;
- rc = pm8058_read(pm8058_gpio_chip.pm_chip,
- SSBI_REG_ADDR_GPIO(gpio), data, 1);
-
-bail_out:
- mutex_unlock(&pm8058_gpio_chip.pm_lock);
-
- return rc;
-}
-
-static ssize_t debug_read(struct file *file, char __user *buf,
- size_t count, loff_t *ppos)
-{
- int gpio = *((int *) file->private_data);
- int len = 0;
- int rc = -EINVAL;
- u8 bank[PM8058_GPIO_BANKS];
- int val = -1;
- int mode;
- int i;
-
- for (i = 0; i < PM8058_GPIO_BANKS; i++) {
- rc = debug_read_gpio_bank(gpio, i, &bank[i]);
- if (rc)
- pr_err("pmic failed to read bank %d\n", i);
- }
-
- if (rc) {
- len = snprintf(debug_read_buf, DEBUG_MAX_RW_BUF - 1, "-1\n");
- goto bail_out;
- }
-
- val = pm8058_gpio_get(&pm8058_gpio_chip, gpio);
-
- /* print the mode and the value */
- mode = (bank[1] & PM8058_GPIO_MODE_MASK) >> PM8058_GPIO_MODE_SHIFT;
- if (mode == PM8058_GPIO_MODE_BOTH)
- len = snprintf(debug_read_buf, DEBUG_MAX_RW_BUF - 1,
- "BOTH %d ", val);
- else if (mode == PM8058_GPIO_MODE_INPUT)
- len = snprintf(debug_read_buf, DEBUG_MAX_RW_BUF - 1,
- "IN %d ", val);
- else if (mode == PM8058_GPIO_MODE_OUTPUT)
- len = snprintf(debug_read_buf, DEBUG_MAX_RW_BUF - 1,
- "OUT %d ", val);
- else
- len = snprintf(debug_read_buf, DEBUG_MAX_RW_BUF - 1,
- "OFF %d ", val);
-
- /* print the control register values */
- len += snprintf(debug_read_buf + len, DEBUG_MAX_RW_BUF - len - 1,
- "[0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x]\n",
- bank[0], bank[1], bank[2], bank[3], bank[4], bank[5]);
-
-bail_out:
- rc = simple_read_from_buffer((void __user *) buf, len,
- ppos, (void *) debug_read_buf, len);
-
- return rc;
-}
-
-static ssize_t debug_write(struct file *file, const char __user *buf,
- size_t count, loff_t *ppos)
-{
- int gpio = *((int *) file->private_data);
- unsigned long val;
- int mode, rc;
-
- mode = (pm8058_gpio_chip.bank1[gpio] & PM8058_GPIO_MODE_MASK) >>
- PM8058_GPIO_MODE_SHIFT;
- if (mode == PM8058_GPIO_MODE_OFF || mode == PM8058_GPIO_MODE_INPUT)
- return count;
-
- if (count > sizeof(debug_write_buf))
- return -EFAULT;
-
- if (copy_from_user(debug_write_buf, buf, count)) {
- pr_err("failed to copy from user\n");
- return -EFAULT;
- }
- debug_write_buf[count] = '\0';
-
- rc = strict_strtoul(debug_write_buf, 10, &val);
- if (rc)
- return rc;
-
- if (pm8058_gpio_set(&pm8058_gpio_chip, gpio, val)) {
- pr_err("gpio write failed\n");
- return -EINVAL;
- }
-
- return count;
-}
-
-static const struct file_operations debug_ops = {
- .open = debug_open,
- .read = debug_read,
- .write = debug_write,
-};
-
-static void debug_init(void)
-{
- int i;
- char name[DEBUG_MAX_FNAME];
-
- debug_dent = debugfs_create_dir("pm_gpio", NULL);
- if (IS_ERR(debug_dent)) {
- pr_err("pmic8058 debugfs_create_dir fail, error %ld\n",
- PTR_ERR(debug_dent));
- return;
- }
-
- for (i = 0; i < PM8058_GPIOS; i++) {
- snprintf(name, DEBUG_MAX_FNAME-1, "%d", i+1);
- debug_gpios[i] = i;
- if (debugfs_create_file(name, 0644, debug_dent,
- &debug_gpios[i], &debug_ops) == NULL) {
- pr_err("pmic8058 debugfs_create_file %s failed\n",
- name);
- }
- }
-}
-
-static void debug_exit(void)
-{
- debugfs_remove_recursive(debug_dent);
-}
-
-#else
-static void debug_init(void) { }
-static void debug_exit(void) { }
-#endif
-
-static int __init pm8058_gpio_init(void)
-{
- int rc = platform_driver_register(&pm8058_gpio_driver);
- if (!rc)
- debug_init();
- return rc;
-}
-
-static void __exit pm8058_gpio_exit(void)
-{
- platform_driver_unregister(&pm8058_gpio_driver);
- debug_exit();
-}
-
-subsys_initcall(pm8058_gpio_init);
-module_exit(pm8058_gpio_exit);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("PMIC8058 GPIO driver");
-MODULE_VERSION("1.0");
-MODULE_ALIAS("platform:pm8058-gpio");
diff --git a/arch/arm/mach-msm/pmic8058-mpp.c b/arch/arm/mach-msm/pmic8058-mpp.c
deleted file mode 100644
index 78a132a..0000000
--- a/arch/arm/mach-msm/pmic8058-mpp.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/* Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * 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.
- *
- */
-/*
- * Qualcomm PMIC8058 MPP driver
- *
- */
-
-#include <linux/platform_device.h>
-#include <linux/gpio.h>
-#include <linux/mfd/pmic8058.h>
-#include <mach/mpp.h>
-#include <linux/seq_file.h>
-
-#ifndef CONFIG_GPIOLIB
-#include "gpio_chip.h"
-#endif
-
-/* MPP Control Registers */
-#define SSBI_MPP_CNTRL_BASE 0x50
-#define SSBI_MPP_CNTRL(n) (SSBI_MPP_CNTRL_BASE + (n))
-
-/* MPP Type */
-#define PM8058_MPP_TYPE_MASK 0xE0
-#define PM8058_MPP_TYPE_SHIFT 5
-
-/* MPP Config Level */
-#define PM8058_MPP_CONFIG_LVL_MASK 0x1C
-#define PM8058_MPP_CONFIG_LVL_SHIFT 2
-
-/* MPP Config Control */
-#define PM8058_MPP_CONFIG_CTL_MASK 0x03
-
-static int pm8058_mpp_get(struct gpio_chip *chip, unsigned mpp)
-{
- struct pm8058_gpio_platform_data *pdata;
- struct pm8058_chip *pm_chip;
-
- if (mpp >= PM8058_MPPS || chip == NULL)
- return -EINVAL;
-
- pdata = chip->dev->platform_data;
- pm_chip = dev_get_drvdata(chip->dev->parent);
-
- return pm8058_irq_get_rt_status(pm_chip,
- pdata->irq_base + mpp);
-}
-
-#ifndef CONFIG_GPIOLIB
-static int pm8058_mpp_get_irq_num(struct gpio_chip *chip,
- unsigned int gpio,
- unsigned int *irqp,
- unsigned long *irqnumflagsp)
-{
- struct pm8058_gpio_platform_data *pdata;
-
- pdata = chip->dev->platform_data;
- gpio -= chip->start;
- *irqp = pdata->irq_base + gpio;
- if (irqnumflagsp)
- *irqnumflagsp = 0;
- return 0;
-}
-
-static int pm8058_mpp_read(struct gpio_chip *chip, unsigned n)
-{
- n -= chip->start;
- return pm8058_mpp_get(chip, n);
-}
-
-struct msm_gpio_chip pm8058_mpp_chip = {
- .chip = {
- .get_irq_num = pm8058_mpp_get_irq_num,
- .read = pm8058_mpp_read,
- }
-};
-
-int pm8058_mpp_config(unsigned mpp, unsigned type, unsigned level,
- unsigned control)
-{
- u8 config;
- int rc;
- struct pm8058_chip *pm_chip;
-
- if (mpp >= PM8058_MPPS)
- return -EINVAL;
-
- pm_chip = dev_get_drvdata(pm8058_mpp_chip->dev->parent);
-
- config = (type << PM8058_MPP_TYPE_SHIFT) & PM8058_MPP_TYPE_MASK;
- config |= (level << PM8058_MPP_CONFIG_LVL_SHIFT) &
- PM8058_MPP_CONFIG_LVL_MASK;
- config |= control & PM8058_MPP_CONFIG_CTL_MASK;
-
- rc = pm8058_write(pm_chip, SSBI_MPP_CNTRL(mpp), &config, 1);
- if (rc)
- pr_err("%s: pm8058_write(): rc=%d\n", __func__, rc);
-
- return rc;
-}
-EXPORT_SYMBOL(pm8058_mpp_config);
-
-static int __devinit pm8058_mpp_probe(struct platform_device *pdev)
-{
- int rc;
- struct pm8058_gpio_platform_data *pdata = pdev->dev.platform_data;
-
- pm8058_mpp_chip.chip.dev = &pdev->dev;
- pm8058_mpp_chip.chip.start = pdata->gpio_base;
- pm8058_mpp_chip.chip.end = pdata->gpio_base + PM8058_MPPS - 1;
- rc = register_gpio_chip(&pm8058_mpp_chip.chip);
- if (!rc) {
- if (pdata->init)
- ret = pdata->init();
- }
- pr_info("%s: register_gpio_chip(): rc=%d\n", __func__, rc);
-
- return rc;
-}
-
-static int __devexit pm8058_mpp_remove(struct platform_device *pdev)
-{
- return 0;
-}
-
-#else
-
-static int pm8058_mpp_to_irq(struct gpio_chip *chip, unsigned offset)
-{
- struct pm8058_gpio_platform_data *pdata;
- pdata = chip->dev->platform_data;
- return pdata->irq_base + offset;
-}
-
-static int pm8058_mpp_read(struct gpio_chip *chip, unsigned offset)
-{
- return pm8058_mpp_get(chip, offset);
-}
-
-static void pm8058_mpp_dbg_show(struct seq_file *s, struct gpio_chip *chip)
-{
- static const char *ctype[] = { "d_in", "d_out", "bi_dir", "a_in",
- "a_out", "sink", "dtest_sink", "dtest_out" };
- struct pm8058_chip *pm_chip = dev_get_drvdata(chip->dev->parent);
- u8 type, state, ctrl;
- const char *label;
- int i;
-
- for (i = 0; i < PM8058_MPPS; i++) {
- pm8058_read(pm_chip, SSBI_MPP_CNTRL(i), &ctrl, 1);
- label = gpiochip_is_requested(chip, i);
- type = (ctrl & PM8058_MPP_TYPE_MASK) >>
- PM8058_MPP_TYPE_SHIFT;
- state = pm8058_mpp_get(chip, i);
- seq_printf(s, "gpio-%-3d (%-12.12s) %-10.10s"
- " %s 0x%02x\n",
- chip->base + i,
- label ? label : "--",
- ctype[type],
- state ? "hi" : "lo",
- ctrl);
- }
-}
-
-static struct gpio_chip pm8058_mpp_chip = {
- .label = "pm8058-mpp",
- .to_irq = pm8058_mpp_to_irq,
- .get = pm8058_mpp_read,
- .dbg_show = pm8058_mpp_dbg_show,
- .ngpio = PM8058_MPPS,
- .can_sleep = 1,
-};
-
-int pm8058_mpp_config(unsigned mpp, unsigned type, unsigned level,
- unsigned control)
-{
- u8 config;
- int rc;
- struct pm8058_chip *pm_chip;
-
- if (mpp >= PM8058_MPPS)
- return -EINVAL;
-
- pm_chip = dev_get_drvdata(pm8058_mpp_chip.dev->parent);
-
- config = (type << PM8058_MPP_TYPE_SHIFT) & PM8058_MPP_TYPE_MASK;
- config |= (level << PM8058_MPP_CONFIG_LVL_SHIFT) &
- PM8058_MPP_CONFIG_LVL_MASK;
- config |= control & PM8058_MPP_CONFIG_CTL_MASK;
-
- rc = pm8058_write(pm_chip, SSBI_MPP_CNTRL(mpp), &config, 1);
- if (rc)
- pr_err("%s: pm8058_write(): rc=%d\n", __func__, rc);
-
- return rc;
-}
-EXPORT_SYMBOL(pm8058_mpp_config);
-
-static int __devinit pm8058_mpp_probe(struct platform_device *pdev)
-{
- int ret;
- struct pm8058_gpio_platform_data *pdata = pdev->dev.platform_data;
-
- pm8058_mpp_chip.dev = &pdev->dev;
- pm8058_mpp_chip.base = pdata->gpio_base;
- ret = gpiochip_add(&pm8058_mpp_chip);
- if (!ret) {
- if (pdata->init)
- ret = pdata->init();
- }
-
- pr_info("%s: gpiochip_add(): ret=%d\n", __func__, ret);
- return ret;
-}
-
-static int __devexit pm8058_mpp_remove(struct platform_device *pdev)
-{
- return gpiochip_remove(&pm8058_mpp_chip);
-}
-
-#endif
-
-static struct platform_driver pm8058_mpp_driver = {
- .probe = pm8058_mpp_probe,
- .remove = __devexit_p(pm8058_mpp_remove),
- .driver = {
- .name = "pm8058-mpp",
- .owner = THIS_MODULE,
- },
-};
-
-static int __init pm8058_mpp_init(void)
-{
- return platform_driver_register(&pm8058_mpp_driver);
-}
-
-static void __exit pm8058_mpp_exit(void)
-{
- platform_driver_unregister(&pm8058_mpp_driver);
-}
-
-subsys_initcall(pm8058_mpp_init);
-module_exit(pm8058_mpp_exit);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("PMIC8058 MPP driver");
-MODULE_VERSION("1.0");
-MODULE_ALIAS("platform:pm8058-mpp");
-
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 385e9c7..8f3263e 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -454,16 +454,6 @@
Select this option to enable GPIO driver for the TPS65910
chip family.
-config MPP_PMIC8901
- tristate "Qualcomm PMIC8901 MPP"
- depends on GPIOLIB && PMIC8901
- default y
- help
- Say yes here to support GPIO functionality on Qualcomm's
- PM8901 chip for MPP(Multi-Purpose Pin) pins. These pins
- work like GPIO pins when configured as digital input and/or
- output signals.
-
config GPIO_PM8XXX
tristate "Qualcomm PM8xxx GPIO support"
depends on MFD_PM8XXX
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 1b2c4b1..83972f1 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -48,7 +48,6 @@
obj-$(CONFIG_GPIO_ML_IOH) += ml_ioh_gpio.o
obj-$(CONFIG_AB8500_GPIO) += ab8500-gpio.o
obj-$(CONFIG_GPIO_TPS65910) += tps65910-gpio.o
-obj-$(CONFIG_MPP_PMIC8901) += pmic8901-mpp.o
obj-$(CONFIG_GPIO_PM8XXX) += pm8xxx-gpio.o
obj-$(CONFIG_GPIO_PM8XXX_MPP) += pm8xxx-mpp.o
obj-$(CONFIG_GPIO_PM8XXX_RPC) += gpio-pm8xxx-rpc.o
diff --git a/drivers/gpio/pmic8901-mpp.c b/drivers/gpio/pmic8901-mpp.c
deleted file mode 100644
index 85e6539..0000000
--- a/drivers/gpio/pmic8901-mpp.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * 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.
- *
- */
-/*
- * Qualcomm PMIC8901 MPP driver
- *
- */
-
-#include <linux/platform_device.h>
-#include <linux/gpio.h>
-#include <linux/mfd/pmic8901.h>
-#include <mach/mpp.h>
-#include <linux/seq_file.h>
-
-/* MPP Control Registers */
-#define SSBI_MPP_CNTRL_BASE 0x27
-#define SSBI_MPP_CNTRL(n) (SSBI_MPP_CNTRL_BASE + (n))
-
-/* MPP Type */
-#define PM8901_MPP_TYPE_MASK 0xE0
-#define PM8901_MPP_TYPE_SHIFT 5
-
-/* MPP Config Level */
-#define PM8901_MPP_CONFIG_LVL_MASK 0x1C
-#define PM8901_MPP_CONFIG_LVL_SHIFT 2
-
-/* MPP Config Control */
-#define PM8901_MPP_CONFIG_CTL_MASK 0x03
-
-struct pm8901_mpp_chip {
- struct gpio_chip chip;
- struct pm8901_chip *pm_chip;
- u8 ctrl[PM8901_MPPS];
-};
-
-static int pm8901_mpp_write(struct pm8901_chip *chip, u16 addr, u8 val,
- u8 mask, u8 *bak)
-{
- u8 reg = (*bak & ~mask) | (val & mask);
- int rc = pm8901_write(chip, addr, ®, 1);
- if (!rc)
- *bak = reg;
- return rc;
-}
-
-static int pm8901_mpp_to_irq(struct gpio_chip *chip, unsigned offset)
-{
- struct pm8901_gpio_platform_data *pdata;
- pdata = chip->dev->platform_data;
- return pdata->irq_base + offset;
-}
-
-static int pm8901_mpp_get(struct gpio_chip *chip, unsigned offset)
-{
- struct pm8901_mpp_chip *mpp_chip = dev_get_drvdata(chip->dev);
- int ret;
-
- if ((mpp_chip->ctrl[offset] & PM8901_MPP_TYPE_MASK) >>
- PM8901_MPP_TYPE_SHIFT == PM_MPP_TYPE_D_OUTPUT)
- ret = mpp_chip->ctrl[offset] & PM8901_MPP_CONFIG_CTL_MASK;
- else
- ret = pm8901_irq_get_rt_status(mpp_chip->pm_chip,
- pm8901_mpp_to_irq(chip, offset));
- return ret;
-}
-
-static void pm8901_mpp_set(struct gpio_chip *chip, unsigned offset, int val)
-{
- struct pm8901_mpp_chip *mpp_chip = dev_get_drvdata(chip->dev);
- u8 reg = val ? PM_MPP_DOUT_CTL_HIGH : PM_MPP_DOUT_CTL_LOW;
- int rc;
-
- rc = pm8901_mpp_write(mpp_chip->pm_chip, SSBI_MPP_CNTRL(offset),
- reg, PM8901_MPP_CONFIG_CTL_MASK,
- &mpp_chip->ctrl[offset]);
- if (rc)
- pr_err("%s: pm8901_mpp_write(): rc=%d\n", __func__, rc);
-}
-
-static int pm8901_mpp_dir_input(struct gpio_chip *chip, unsigned offset)
-{
- struct pm8901_mpp_chip *mpp_chip = dev_get_drvdata(chip->dev);
- int rc = pm8901_mpp_write(mpp_chip->pm_chip,
- SSBI_MPP_CNTRL(offset),
- PM_MPP_TYPE_D_INPUT << PM8901_MPP_TYPE_SHIFT,
- PM8901_MPP_TYPE_MASK, &mpp_chip->ctrl[offset]);
- if (rc)
- pr_err("%s: pm8901_mpp_write(): rc=%d\n", __func__, rc);
- return rc;
-}
-
-static int pm8901_mpp_dir_output(struct gpio_chip *chip,
- unsigned offset, int val)
-{
- struct pm8901_mpp_chip *mpp_chip = dev_get_drvdata(chip->dev);
- u8 reg = (PM_MPP_TYPE_D_OUTPUT << PM8901_MPP_TYPE_SHIFT) |
- (val & PM8901_MPP_CONFIG_CTL_MASK);
- u8 mask = PM8901_MPP_TYPE_MASK | PM8901_MPP_CONFIG_CTL_MASK;
- int rc = pm8901_mpp_write(mpp_chip->pm_chip,
- SSBI_MPP_CNTRL(offset), reg, mask,
- &mpp_chip->ctrl[offset]);
- if (rc)
- pr_err("%s: pm8901_mpp_write(): rc=%d\n", __func__, rc);
- return rc;
-}
-
-static void pm8901_mpp_dbg_show(struct seq_file *s, struct gpio_chip *chip)
-{
- static const char *ctype[] = { "d_in", "d_out", "bi_dir", "a_in",
- "a_out", "sink", "dtest_sink", "dtest_out" };
- struct pm8901_mpp_chip *mpp_chip = dev_get_drvdata(chip->dev);
- u8 type, state;
- const char *label;
- int i;
-
- for (i = 0; i < PM8901_MPPS; i++) {
- label = gpiochip_is_requested(chip, i);
- type = (mpp_chip->ctrl[i] & PM8901_MPP_TYPE_MASK) >>
- PM8901_MPP_TYPE_SHIFT;
- state = pm8901_mpp_get(chip, i);
- seq_printf(s, "gpio-%-3d (%-12.12s) %-10.10s"
- " %s 0x%02x\n",
- chip->base + i,
- label ? label : "--",
- ctype[type],
- state ? "hi" : "lo",
- mpp_chip->ctrl[i]);
- }
-}
-
-static struct pm8901_mpp_chip pm8901_mpp_chip = {
- .chip = {
- .label = "pm8901-mpp",
- .to_irq = pm8901_mpp_to_irq,
- .get = pm8901_mpp_get,
- .set = pm8901_mpp_set,
- .direction_input = pm8901_mpp_dir_input,
- .direction_output = pm8901_mpp_dir_output,
- .dbg_show = pm8901_mpp_dbg_show,
- .ngpio = PM8901_MPPS,
- },
-};
-
-int pm8901_mpp_config(unsigned mpp, unsigned type, unsigned level,
- unsigned control)
-{
- u8 config, mask;
- int rc;
-
- if (mpp >= PM8901_MPPS)
- return -EINVAL;
-
- mask = PM8901_MPP_TYPE_MASK | PM8901_MPP_CONFIG_LVL_MASK |
- PM8901_MPP_CONFIG_CTL_MASK;
- config = (type << PM8901_MPP_TYPE_SHIFT) & PM8901_MPP_TYPE_MASK;
- config |= (level << PM8901_MPP_CONFIG_LVL_SHIFT) &
- PM8901_MPP_CONFIG_LVL_MASK;
- config |= control & PM8901_MPP_CONFIG_CTL_MASK;
-
- rc = pm8901_mpp_write(pm8901_mpp_chip.pm_chip, SSBI_MPP_CNTRL(mpp),
- config, mask, &pm8901_mpp_chip.ctrl[mpp]);
- if (rc)
- pr_err("%s: pm8901_mpp_write(): rc=%d\n", __func__, rc);
-
- return rc;
-}
-EXPORT_SYMBOL(pm8901_mpp_config);
-
-static int __devinit pm8901_mpp_probe(struct platform_device *pdev)
-{
- int ret, i;
- struct pm8901_gpio_platform_data *pdata = pdev->dev.platform_data;
-
- pm8901_mpp_chip.pm_chip = dev_get_drvdata(pdev->dev.parent);
- for (i = 0; i < PM8901_MPPS; i++) {
- ret = pm8901_read(pm8901_mpp_chip.pm_chip,
- SSBI_MPP_CNTRL(i), &pm8901_mpp_chip.ctrl[i], 1);
- if (ret)
- goto bail;
-
- }
- platform_set_drvdata(pdev, &pm8901_mpp_chip);
- pm8901_mpp_chip.chip.dev = &pdev->dev;
- pm8901_mpp_chip.chip.base = pdata->gpio_base;
- ret = gpiochip_add(&pm8901_mpp_chip.chip);
-
-bail:
- pr_info("%s: gpiochip_add(): rc=%d\n", __func__, ret);
- return ret;
-}
-
-static int __devexit pm8901_mpp_remove(struct platform_device *pdev)
-{
- return gpiochip_remove(&pm8901_mpp_chip.chip);
-}
-
-static struct platform_driver pm8901_mpp_driver = {
- .probe = pm8901_mpp_probe,
- .remove = __devexit_p(pm8901_mpp_remove),
- .driver = {
- .name = "pm8901-mpp",
- .owner = THIS_MODULE,
- },
-};
-
-static int __init pm8901_mpp_init(void)
-{
- return platform_driver_register(&pm8901_mpp_driver);
-}
-
-static void __exit pm8901_mpp_exit(void)
-{
- platform_driver_unregister(&pm8901_mpp_driver);
-}
-
-subsys_initcall(pm8901_mpp_init);
-module_exit(pm8901_mpp_exit);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("PMIC8901 MPP driver");
-MODULE_VERSION("1.0");
-MODULE_ALIAS("platform:pm8901-mpp");
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 6db0da1..ec392c3 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -594,28 +594,6 @@
To compile this driver as a module, choose M here: the
module will be called w90p910_keypad.
-config KEYBOARD_PMIC8058
- tristate "Qualcomm PMIC8058 keypad"
- depends on PMIC8058
- default y
- help
- Say Y here if you want to enable the driver for the PMIC8058
- keypad provided as a reference design from Qualcomm. This is intended
- to support upto 18x8 matrix based keypad design.
-
- To compile this driver as a module, choose M here: the module will
- be called pmic8058-keypad.
endif
-config KEYBOARD_PMIC8058
- tristate "Qualcomm PMIC8058 keypad"
- depends on PMIC8058
- default y
- help
- Say Y here if you want to enable the driver for the PMIC8058
- keypad provided as a reference design from Qualcomm. This is intended
- to support upto 18x8 matrix based keypad design.
-
- To compile this driver as a module, choose M here: the module will
- be called pmic8058-keypad.
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
index cf4c058..b22df06 100644
--- a/drivers/input/keyboard/Makefile
+++ b/drivers/input/keyboard/Makefile
@@ -34,7 +34,6 @@
obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o
obj-$(CONFIG_KEYBOARD_OMAP4) += omap4-keypad.o
obj-$(CONFIG_KEYBOARD_OPENCORES) += opencores-kbd.o
-obj-$(CONFIG_KEYBOARD_PM8058) += pm8058-keypad.o
obj-$(CONFIG_KEYBOARD_PMIC8XXX) += pmic8xxx-keypad.o
obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keypad.o
obj-$(CONFIG_KEYBOARD_PXA930_ROTARY) += pxa930_rotary.o
diff --git a/drivers/input/keyboard/pmic8058-keypad.c b/drivers/input/keyboard/pmic8058-keypad.c
deleted file mode 100644
index 9c7588e..0000000
--- a/drivers/input/keyboard/pmic8058-keypad.c
+++ /dev/null
@@ -1,948 +0,0 @@
-/* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * 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.
- *
- */
-
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/kernel.h>
-#include <linux/interrupt.h>
-#include <linux/input.h>
-#include <linux/bitops.h>
-#include <linux/mfd/pmic8058.h>
-#include <linux/delay.h>
-#include <linux/mutex.h>
-#include <linux/slab.h>
-#include <linux/pm.h>
-#include <linux/pm_runtime.h>
-
-#include <linux/input/pmic8058-keypad.h>
-
-#define PM8058_MAX_ROWS 18
-#define PM8058_MAX_COLS 8
-#define PM8058_ROW_SHIFT 3
-#define PM8058_MATRIX_MAX_SIZE (PM8058_MAX_ROWS * PM8058_MAX_COLS)
-
-#define PM8058_MIN_ROWS 5
-#define PM8058_MIN_COLS 5
-
-#define MAX_SCAN_DELAY 128
-#define MIN_SCAN_DELAY 1
-
-/* in nanoseconds */
-#define MAX_ROW_HOLD_DELAY 122000
-#define MIN_ROW_HOLD_DELAY 30500
-
-#define MAX_DEBOUNCE_B0_TIME 20
-#define MIN_DEBOUNCE_B0_TIME 5
-
-#define MAX_DEBOUNCE_A0_TIME 8
-#define MIN_DEBOUNCE_A0_TIME 1
-
-#define KEYP_CTRL 0x148
-
-#define KEYP_CTRL_EVNTS BIT(0)
-#define KEYP_CTRL_EVNTS_MASK 0x3
-
-#define KEYP_CTRL_SCAN_COLS_SHIFT 5
-#define KEYP_CTRL_SCAN_COLS_MIN 5
-#define KEYP_CTRL_SCAN_COLS_BITS 0x3
-
-#define KEYP_CTRL_SCAN_ROWS_SHIFT 2
-#define KEYP_CTRL_SCAN_ROWS_MIN 5
-#define KEYP_CTRL_SCAN_ROWS_BITS 0x7
-
-#define KEYP_CTRL_KEYP_EN BIT(7)
-
-#define KEYP_SCAN 0x149
-
-#define KEYP_SCAN_READ_STATE BIT(0)
-#define KEYP_SCAN_DBOUNCE_SHIFT 1
-#define KEYP_SCAN_PAUSE_SHIFT 3
-#define KEYP_SCAN_ROW_HOLD_SHIFT 6
-
-#define KEYP_TEST 0x14A
-
-#define KEYP_TEST_CLEAR_RECENT_SCAN BIT(6)
-#define KEYP_TEST_CLEAR_OLD_SCAN BIT(5)
-#define KEYP_TEST_READ_RESET BIT(4)
-#define KEYP_TEST_DTEST_EN BIT(3)
-#define KEYP_TEST_ABORT_READ BIT(0)
-
-#define KEYP_TEST_DBG_SELECT_SHIFT 1
-
-/* bits of these register represent
- * '0' for key press
- * '1' for key release
- */
-#define KEYP_RECENT_DATA 0x14B
-#define KEYP_OLD_DATA 0x14C
-
-#define KEYP_CLOCK_FREQ 32768
-
-/* Internal flags */
-#define KEYF_FIX_LAST_ROW 0x01
-
-
-/* ---------------------------------------------------------------------*/
-struct pmic8058_kp {
- const struct pmic8058_keypad_data *pdata;
- struct input_dev *input;
- int key_sense_irq;
- int key_stuck_irq;
-
- unsigned short *keycodes;
-
- struct device *dev;
- u16 keystate[PM8058_MAX_ROWS];
- u16 stuckstate[PM8058_MAX_ROWS];
-
- u32 flags;
- struct pm8058_chip *pm_chip;
-
- /* protect read/write */
- struct mutex mutex;
- bool user_disabled;
- u32 disable_depth;
-
- u8 ctrl_reg;
-};
-
-static int pmic8058_kp_write_u8(struct pmic8058_kp *kp,
- u8 data, u16 reg)
-{
- int rc;
-
- rc = pm8058_write(kp->pm_chip, reg, &data, 1);
- if (rc < 0)
- dev_warn(kp->dev, "Error writing pmic8058: %X - ret %X\n",
- reg, rc);
- return rc;
-}
-
-static int pmic8058_kp_read(struct pmic8058_kp *kp,
- u8 *data, u16 reg, unsigned num_bytes)
-{
- int rc;
-
- rc = pm8058_read(kp->pm_chip, reg, data, num_bytes);
- if (rc < 0)
- dev_warn(kp->dev, "Error reading pmic8058: %X - ret %X\n",
- reg, rc);
-
- return rc;
-}
-
-static int pmic8058_kp_read_u8(struct pmic8058_kp *kp,
- u8 *data, u16 reg)
-{
- int rc;
-
- rc = pmic8058_kp_read(kp, data, reg, 1);
- if (rc < 0)
- dev_warn(kp->dev, "Error reading pmic8058: %X - ret %X\n",
- reg, rc);
- return rc;
-}
-
-static u8 pmic8058_col_state(struct pmic8058_kp *kp, u8 col)
-{
- /* all keys pressed on that particular row? */
- if (col == 0x00)
- return 1 << kp->pdata->num_cols;
- else
- return col & ((1 << kp->pdata->num_cols) - 1);
-}
-/* REVISIT: just for debugging, will be removed in final working version */
-static void __dump_kp_regs(struct pmic8058_kp *kp, char *msg)
-{
- u8 temp;
-
- dev_dbg(kp->dev, "%s\n", msg);
-
- pmic8058_kp_read_u8(kp, &temp, KEYP_CTRL);
- dev_dbg(kp->dev, "KEYP_CTRL - %X\n", temp);
- pmic8058_kp_read_u8(kp, &temp, KEYP_SCAN);
- dev_dbg(kp->dev, "KEYP_SCAN - %X\n", temp);
- pmic8058_kp_read_u8(kp, &temp, KEYP_TEST);
- dev_dbg(kp->dev, "KEYP_TEST - %X\n", temp);
-}
-
-/* H/W constraint:
- * One should read recent/old data registers equal to the
- * number of columns programmed in the keyp_control register,
- * otherwise h/w state machine may get stuck. In order to avoid this
- * situation one should check readstate bit in keypad scan
- * register to be '0' at the end of data read, to make sure
- * the keypad state machine is not in READ state.
- */
-static int pmic8058_chk_read_state(struct pmic8058_kp *kp, u16 data_reg)
-{
- u8 temp, scan_val;
- int retries = 10, rc;
-
- do {
- rc = pmic8058_kp_read_u8(kp, &scan_val, KEYP_SCAN);
- if (scan_val & 0x1)
- rc = pmic8058_kp_read_u8(kp, &temp, data_reg);
- } while ((scan_val & 0x1) && (--retries > 0));
-
- if (retries == 0)
- dev_dbg(kp->dev, "Unable to clear read state bit\n");
-
- return 0;
-}
-/*
- * Synchronous read protocol for RevB0 onwards:
- *
- * 1. Write '1' to ReadState bit in KEYP_SCAN register
- * 2. Wait 2*32KHz clocks, so that HW can successfully enter read mode
- * synchronously
- * 3. Read rows in old array first if events are more than one
- * 4. Read rows in recent array
- * 5. Wait 4*32KHz clocks
- * 6. Write '0' to ReadState bit of KEYP_SCAN register so that hw can
- * synchronously exit read mode.
- */
-static int pmic8058_chk_sync_read(struct pmic8058_kp *kp)
-{
- int rc;
- u8 scan_val;
-
- rc = pmic8058_kp_read_u8(kp, &scan_val, KEYP_SCAN);
- scan_val |= 0x1;
- rc = pmic8058_kp_write_u8(kp, scan_val, KEYP_SCAN);
-
- /* 2 * 32KHz clocks */
- udelay((2 * USEC_PER_SEC / KEYP_CLOCK_FREQ) + 1);
-
- return rc;
-}
-
-static int pmic8058_kp_read_data(struct pmic8058_kp *kp, u16 *state,
- u16 data_reg, int read_rows)
-{
- int rc, row;
- u8 new_data[PM8058_MAX_ROWS];
-
- rc = pmic8058_kp_read(kp, new_data, data_reg, read_rows);
-
- if (!rc) {
- if (pm8058_rev(kp->pm_chip) == PM_8058_REV_1p0)
- pmic8058_chk_read_state(kp, data_reg);
- for (row = 0; row < kp->pdata->num_rows; row++) {
- dev_dbg(kp->dev, "new_data[%d] = %d\n", row,
- new_data[row]);
- state[row] = pmic8058_col_state(kp, new_data[row]);
- }
- }
-
- return rc;
-}
-
-static int pmic8058_kp_read_matrix(struct pmic8058_kp *kp, u16 *new_state,
- u16 *old_state)
-{
- int rc, read_rows;
- u8 scan_val;
- static u8 rows[] = {
- 5, 6, 7, 8, 10, 10, 12, 12, 15, 15, 15, 18, 18, 18
- };
-
- if (kp->flags & KEYF_FIX_LAST_ROW &&
- (kp->pdata->num_rows != PM8058_MAX_ROWS))
- read_rows = rows[kp->pdata->num_rows - KEYP_CTRL_SCAN_ROWS_MIN
- + 1];
- else
- read_rows = kp->pdata->num_rows;
-
- if (pm8058_rev(kp->pm_chip) > PM_8058_REV_1p0)
- pmic8058_chk_sync_read(kp);
-
- if (old_state)
- rc = pmic8058_kp_read_data(kp, old_state, KEYP_OLD_DATA,
- read_rows);
-
- rc = pmic8058_kp_read_data(kp, new_state, KEYP_RECENT_DATA,
- read_rows);
-
- if (pm8058_rev(kp->pm_chip) > PM_8058_REV_1p0) {
- /* 4 * 32KHz clocks */
- udelay((4 * USEC_PER_SEC / KEYP_CLOCK_FREQ) + 1);
-
- rc = pmic8058_kp_read(kp, &scan_val, KEYP_SCAN, 1);
- scan_val &= 0xFE;
- rc = pmic8058_kp_write_u8(kp, scan_val, KEYP_SCAN);
- }
-
- return rc;
-}
-
-static int __pmic8058_kp_scan_matrix(struct pmic8058_kp *kp, u16 *new_state,
- u16 *old_state)
-{
- int row, col, code;
-
- for (row = 0; row < kp->pdata->num_rows; row++) {
- int bits_changed = new_state[row] ^ old_state[row];
-
- if (!bits_changed)
- continue;
-
- for (col = 0; col < kp->pdata->num_cols; col++) {
- if (!(bits_changed & (1 << col)))
- continue;
-
- dev_dbg(kp->dev, "key [%d:%d] %s\n", row, col,
- !(new_state[row] & (1 << col)) ?
- "pressed" : "released");
-
- code = MATRIX_SCAN_CODE(row, col, PM8058_ROW_SHIFT);
- input_event(kp->input, EV_MSC, MSC_SCAN, code);
- input_report_key(kp->input,
- kp->keycodes[code],
- !(new_state[row] & (1 << col)));
-
- input_sync(kp->input);
- }
- }
-
- return 0;
-}
-
-static int pmic8058_detect_ghost_keys(struct pmic8058_kp *kp, u16 *new_state)
-{
- int row, found_first = -1;
- u16 check, row_state;
-
- check = 0;
- for (row = 0; row < kp->pdata->num_rows; row++) {
- row_state = (~new_state[row]) &
- ((1 << kp->pdata->num_cols) - 1);
-
- if (hweight16(row_state) > 1) {
- if (found_first == -1)
- found_first = row;
- if (check & row_state) {
- dev_dbg(kp->dev, "detected ghost key on row[%d]"
- "row[%d]\n", found_first, row);
- return 1;
- }
- }
- check |= row_state;
- }
- return 0;
-}
-
-static int pmic8058_kp_scan_matrix(struct pmic8058_kp *kp, unsigned int events)
-{
- u16 new_state[PM8058_MAX_ROWS];
- u16 old_state[PM8058_MAX_ROWS];
- int rc;
-
- switch (events) {
- case 0x1:
- rc = pmic8058_kp_read_matrix(kp, new_state, NULL);
- if (pmic8058_detect_ghost_keys(kp, new_state))
- return -EINVAL;
- __pmic8058_kp_scan_matrix(kp, new_state, kp->keystate);
- memcpy(kp->keystate, new_state, sizeof(new_state));
- break;
- case 0x3: /* two events - eventcounter is gray-coded */
- rc = pmic8058_kp_read_matrix(kp, new_state, old_state);
- __pmic8058_kp_scan_matrix(kp, old_state, kp->keystate);
- __pmic8058_kp_scan_matrix(kp, new_state, old_state);
- memcpy(kp->keystate, new_state, sizeof(new_state));
- break;
- case 0x2:
- dev_dbg(kp->dev, "Some key events are missed\n");
- rc = pmic8058_kp_read_matrix(kp, new_state, old_state);
- __pmic8058_kp_scan_matrix(kp, old_state, kp->keystate);
- __pmic8058_kp_scan_matrix(kp, new_state, old_state);
- memcpy(kp->keystate, new_state, sizeof(new_state));
- break;
- default:
- rc = -1;
- }
- return rc;
-}
-
-static inline int pmic8058_kp_disabled(struct pmic8058_kp *kp)
-{
- return kp->disable_depth != 0;
-}
-
-static void pmic8058_kp_enable(struct pmic8058_kp *kp)
-{
- if (!pmic8058_kp_disabled(kp))
- return;
-
- if (--kp->disable_depth == 0) {
-
- kp->ctrl_reg |= KEYP_CTRL_KEYP_EN;
- pmic8058_kp_write_u8(kp, kp->ctrl_reg, KEYP_CTRL);
-
- enable_irq(kp->key_sense_irq);
- enable_irq(kp->key_stuck_irq);
- }
-}
-
-static void pmic8058_kp_disable(struct pmic8058_kp *kp)
-{
- if (kp->disable_depth++ == 0) {
- disable_irq(kp->key_sense_irq);
- disable_irq(kp->key_stuck_irq);
-
- kp->ctrl_reg &= ~KEYP_CTRL_KEYP_EN;
- pmic8058_kp_write_u8(kp, kp->ctrl_reg, KEYP_CTRL);
- }
-}
-
-static ssize_t pmic8058_kp_disable_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct pmic8058_kp *kp = dev_get_drvdata(dev);
-
- return sprintf(buf, "%u\n", pmic8058_kp_disabled(kp));
-}
-
-static ssize_t pmic8058_kp_disable_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- struct pmic8058_kp *kp = dev_get_drvdata(dev);
- long i = 0;
- int rc;
-
- rc = strict_strtoul(buf, 10, &i);
- if (rc)
- return -EINVAL;
-
- i = !!i;
-
- mutex_lock(&kp->mutex);
- if (i == kp->user_disabled) {
- mutex_unlock(&kp->mutex);
- return count;
- }
-
- kp->user_disabled = i;
-
- if (i)
- pmic8058_kp_disable(kp);
- else
- pmic8058_kp_enable(kp);
- mutex_unlock(&kp->mutex);
-
- return count;
-}
-
-static DEVICE_ATTR(disable_kp, 0664, pmic8058_kp_disable_show,
- pmic8058_kp_disable_store);
-
-
-/*
- * NOTE: We are reading recent and old data registers blindly
- * whenever key-stuck interrupt happens, because events counter doesn't
- * get updated when this interrupt happens due to key stuck doesn't get
- * considered as key state change.
- *
- * We are not using old data register contents after they are being read
- * because it might report the key which was pressed before the key being stuck
- * as stuck key because it's pressed status is stored in the old data
- * register.
- */
-static irqreturn_t pmic8058_kp_stuck_irq(int irq, void *data)
-{
- u16 new_state[PM8058_MAX_ROWS];
- u16 old_state[PM8058_MAX_ROWS];
- int rc;
- struct pmic8058_kp *kp = data;
-
- rc = pmic8058_kp_read_matrix(kp, new_state, old_state);
- __pmic8058_kp_scan_matrix(kp, new_state, kp->stuckstate);
-
- return IRQ_HANDLED;
-}
-
-/*
- * NOTE: Any row multiple interrupt issue - PMIC4 Rev A0
- *
- * If the S/W responds to the key-event interrupt too early and reads the
- * recent data, the keypad FSM will mistakenly go to the IDLE state, instead
- * of the scan pause state as it is supposed too. Since the key is still
- * pressed, the keypad scanner will go through the debounce, scan, and generate
- * another key event interrupt. The workaround for this issue is to add delay
- * of 1ms between servicing the key event interrupt and reading the recent data.
- */
-static irqreturn_t pmic8058_kp_irq(int irq, void *data)
-{
- struct pmic8058_kp *kp = data;
- u8 ctrl_val, events;
- int rc;
-
- if (pm8058_rev(kp->pm_chip) == PM_8058_REV_1p0)
- mdelay(1);
-
- dev_dbg(kp->dev, "key sense irq\n");
- __dump_kp_regs(kp, "pmic8058_kp_irq");
-
- rc = pmic8058_kp_read(kp, &ctrl_val, KEYP_CTRL, 1);
- events = ctrl_val & KEYP_CTRL_EVNTS_MASK;
-
- rc = pmic8058_kp_scan_matrix(kp, events);
-
- return IRQ_HANDLED;
-}
-/*
- * NOTE: Last row multi-interrupt issue
- *
- * In PMIC Rev A0, if any key in the last row of the keypad matrix
- * is pressed and held, the H/W keeps on generating interrupts.
- * Software work-arounds it by programming the keypad controller next level
- * up rows (for 8x12 matrix it is 15 rows) so the keypad controller
- * thinks of more-rows than the actual ones, so the actual last-row
- * in the matrix won't generate multiple interrupts.
- */
-static int pmic8058_kpd_init(struct pmic8058_kp *kp)
-{
- int bits, rc, cycles;
- u8 scan_val = 0, ctrl_val = 0;
- static u8 row_bits[] = {
- 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7,
- };
-
- /* Find column bits */
- if (kp->pdata->num_cols < KEYP_CTRL_SCAN_COLS_MIN)
- bits = 0;
- else
- bits = kp->pdata->num_cols - KEYP_CTRL_SCAN_COLS_MIN;
- ctrl_val = (bits & KEYP_CTRL_SCAN_COLS_BITS) <<
- KEYP_CTRL_SCAN_COLS_SHIFT;
-
- /* Find row bits */
- if (kp->pdata->num_rows < KEYP_CTRL_SCAN_ROWS_MIN)
- bits = 0;
- else if (kp->pdata->num_rows > PM8058_MAX_ROWS)
- bits = KEYP_CTRL_SCAN_ROWS_BITS;
- else
- bits = row_bits[kp->pdata->num_rows - KEYP_CTRL_SCAN_ROWS_MIN];
-
- /* Use max rows to fix last row problem if actual rows are less */
- if (kp->flags & KEYF_FIX_LAST_ROW &&
- (kp->pdata->num_rows != PM8058_MAX_ROWS))
- bits = row_bits[kp->pdata->num_rows - KEYP_CTRL_SCAN_ROWS_MIN
- + 1];
-
- ctrl_val |= (bits << KEYP_CTRL_SCAN_ROWS_SHIFT);
-
- rc = pmic8058_kp_write_u8(kp, ctrl_val, KEYP_CTRL);
-
- if (pm8058_rev(kp->pm_chip) == PM_8058_REV_1p0)
- bits = fls(kp->pdata->debounce_ms[0]) - 1;
- else
- bits = (kp->pdata->debounce_ms[1] / 5) - 1;
-
- scan_val |= (bits << KEYP_SCAN_DBOUNCE_SHIFT);
-
- bits = fls(kp->pdata->scan_delay_ms) - 1;
- scan_val |= (bits << KEYP_SCAN_PAUSE_SHIFT);
-
- /* Row hold time is a multiple of 32KHz cycles. */
- cycles = (kp->pdata->row_hold_ns * KEYP_CLOCK_FREQ) / NSEC_PER_SEC;
-
- scan_val |= (cycles << KEYP_SCAN_ROW_HOLD_SHIFT);
-
- rc = pmic8058_kp_write_u8(kp, scan_val, KEYP_SCAN);
-
- return rc;
-}
-
-static int pm8058_kp_config_drv(int gpio_start, int num_gpios)
-{
- int rc;
- struct pm8058_gpio kypd_drv = {
- .direction = PM_GPIO_DIR_OUT,
- .output_buffer = PM_GPIO_OUT_BUF_OPEN_DRAIN,
- .output_value = 0,
- .pull = PM_GPIO_PULL_NO,
- .vin_sel = 2,
- .out_strength = PM_GPIO_STRENGTH_LOW,
- .function = PM_GPIO_FUNC_1,
- .inv_int_pol = 1,
- };
-
- if (gpio_start < 0 || num_gpios < 0 || num_gpios > PM8058_GPIOS)
- return -EINVAL;
-
- while (num_gpios--) {
- rc = pm8058_gpio_config(gpio_start++, &kypd_drv);
- if (rc) {
- pr_err("%s: FAIL pm8058_gpio_config(): rc=%d.\n",
- __func__, rc);
- return rc;
- }
- }
-
- return 0;
-}
-
-static int pm8058_kp_config_sns(int gpio_start, int num_gpios)
-{
- int rc;
- struct pm8058_gpio kypd_sns = {
- .direction = PM_GPIO_DIR_IN,
- .pull = PM_GPIO_PULL_UP_31P5,
- .vin_sel = 2,
- .out_strength = PM_GPIO_STRENGTH_NO,
- .function = PM_GPIO_FUNC_NORMAL,
- .inv_int_pol = 1,
- };
-
- if (gpio_start < 0 || num_gpios < 0 || num_gpios > PM8058_GPIOS)
- return -EINVAL;
-
- while (num_gpios--) {
- rc = pm8058_gpio_config(gpio_start++, &kypd_sns);
- if (rc) {
- pr_err("%s: FAIL pm8058_gpio_config(): rc=%d.\n",
- __func__, rc);
- return rc;
- }
- }
-
- return 0;
-}
-
-/*
- * keypad controller should be initialized in the following sequence
- * only, otherwise it might get into FSM stuck state.
- *
- * - Initialize keypad control parameters, like no. of rows, columns,
- * timing values etc.,
- * - configure rows and column gpios pull up/down.
- * - set irq edge type.
- * - enable the keypad controller.
- */
-static int __devinit pmic8058_kp_probe(struct platform_device *pdev)
-{
- struct pmic8058_keypad_data *pdata = pdev->dev.platform_data;
- const struct matrix_keymap_data *keymap_data;
- struct pmic8058_kp *kp;
- int rc;
- unsigned short *keycodes;
- u8 ctrl_val;
- struct pm8058_chip *pm_chip;
-
- pm_chip = dev_get_drvdata(pdev->dev.parent);
- if (pm_chip == NULL) {
- dev_err(&pdev->dev, "no parent data passed in\n");
- return -EFAULT;
- }
-
- if (!pdata || !pdata->num_cols || !pdata->num_rows ||
- pdata->num_cols > PM8058_MAX_COLS ||
- pdata->num_rows > PM8058_MAX_ROWS ||
- pdata->num_cols < PM8058_MIN_COLS ||
- pdata->num_rows < PM8058_MIN_ROWS) {
- dev_err(&pdev->dev, "invalid platform data\n");
- return -EINVAL;
- }
-
- if (pdata->rows_gpio_start < 0 || pdata->cols_gpio_start < 0) {
- dev_err(&pdev->dev, "invalid gpio_start platform data\n");
- return -EINVAL;
- }
-
- if (!pdata->scan_delay_ms || pdata->scan_delay_ms > MAX_SCAN_DELAY
- || pdata->scan_delay_ms < MIN_SCAN_DELAY ||
- !is_power_of_2(pdata->scan_delay_ms)) {
- dev_err(&pdev->dev, "invalid keypad scan time supplied\n");
- return -EINVAL;
- }
-
- if (!pdata->row_hold_ns || pdata->row_hold_ns > MAX_ROW_HOLD_DELAY
- || pdata->row_hold_ns < MIN_ROW_HOLD_DELAY ||
- ((pdata->row_hold_ns % MIN_ROW_HOLD_DELAY) != 0)) {
- dev_err(&pdev->dev, "invalid keypad row hold time supplied\n");
- return -EINVAL;
- }
-
- if (pm8058_rev(pm_chip) == PM_8058_REV_1p0) {
- if (!pdata->debounce_ms
- || !is_power_of_2(pdata->debounce_ms[0])
- || pdata->debounce_ms[0] > MAX_DEBOUNCE_A0_TIME
- || pdata->debounce_ms[0] < MIN_DEBOUNCE_A0_TIME) {
- dev_err(&pdev->dev, "invalid debounce time supplied\n");
- return -EINVAL;
- }
- } else {
- if (!pdata->debounce_ms
- || ((pdata->debounce_ms[1] % 5) != 0)
- || pdata->debounce_ms[1] > MAX_DEBOUNCE_B0_TIME
- || pdata->debounce_ms[1] < MIN_DEBOUNCE_B0_TIME) {
- dev_err(&pdev->dev, "invalid debounce time supplied\n");
- return -EINVAL;
- }
- }
-
- keymap_data = pdata->keymap_data;
- if (!keymap_data) {
- dev_err(&pdev->dev, "no keymap data supplied\n");
- return -EINVAL;
- }
-
- kp = kzalloc(sizeof(*kp), GFP_KERNEL);
- if (!kp)
- return -ENOMEM;
-
- keycodes = kzalloc(PM8058_MATRIX_MAX_SIZE * sizeof(*keycodes),
- GFP_KERNEL);
- if (!keycodes) {
- rc = -ENOMEM;
- goto err_alloc_mem;
- }
-
- platform_set_drvdata(pdev, kp);
- mutex_init(&kp->mutex);
-
- kp->pdata = pdata;
- kp->dev = &pdev->dev;
- kp->keycodes = keycodes;
- kp->pm_chip = pm_chip;
-
- if (pm8058_rev(pm_chip) == PM_8058_REV_1p0)
- kp->flags |= KEYF_FIX_LAST_ROW;
-
- kp->input = input_allocate_device();
- if (!kp->input) {
- dev_err(&pdev->dev, "unable to allocate input device\n");
- rc = -ENOMEM;
- goto err_alloc_device;
- }
-
- /* Enable runtime PM ops, start in ACTIVE mode */
- rc = pm_runtime_set_active(&pdev->dev);
- if (rc < 0)
- dev_dbg(&pdev->dev, "unable to set runtime pm state\n");
- pm_runtime_enable(&pdev->dev);
-
- kp->key_sense_irq = platform_get_irq(pdev, 0);
- if (kp->key_sense_irq < 0) {
- dev_err(&pdev->dev, "unable to get keypad sense irq\n");
- rc = -ENXIO;
- goto err_get_irq;
- }
-
- kp->key_stuck_irq = platform_get_irq(pdev, 1);
- if (kp->key_stuck_irq < 0) {
- dev_err(&pdev->dev, "unable to get keypad stuck irq\n");
- rc = -ENXIO;
- goto err_get_irq;
- }
-
- if (pdata->input_name)
- kp->input->name = pdata->input_name;
- else
- kp->input->name = "PMIC8058 keypad";
-
- if (pdata->input_phys_device)
- kp->input->phys = pdata->input_phys_device;
- else
- kp->input->phys = "pmic8058_keypad/input0";
-
- kp->input->dev.parent = &pdev->dev;
-
- kp->input->id.bustype = BUS_HOST;
- kp->input->id.version = 0x0001;
- kp->input->id.product = 0x0001;
- kp->input->id.vendor = 0x0001;
-
- kp->input->evbit[0] = BIT_MASK(EV_KEY);
-
- if (pdata->rep)
- __set_bit(EV_REP, kp->input->evbit);
-
- kp->input->keycode = keycodes;
- kp->input->keycodemax = PM8058_MATRIX_MAX_SIZE;
- kp->input->keycodesize = sizeof(*keycodes);
-
- matrix_keypad_build_keymap(keymap_data, PM8058_ROW_SHIFT,
- kp->input->keycode, kp->input->keybit);
-
- input_set_capability(kp->input, EV_MSC, MSC_SCAN);
- input_set_drvdata(kp->input, kp);
-
- rc = input_register_device(kp->input);
- if (rc < 0) {
- dev_err(&pdev->dev, "unable to register keypad input device\n");
- goto err_get_irq;
- }
-
- /* initialize keypad state */
- memset(kp->keystate, 0xff, sizeof(kp->keystate));
- memset(kp->stuckstate, 0xff, sizeof(kp->stuckstate));
-
- rc = pmic8058_kpd_init(kp);
- if (rc < 0) {
- dev_err(&pdev->dev, "unable to initialize keypad controller\n");
- goto err_kpd_init;
- }
-
- rc = pm8058_kp_config_sns(pdata->cols_gpio_start,
- pdata->num_cols);
- if (rc < 0) {
- dev_err(&pdev->dev, "unable to configure keypad sense lines\n");
- goto err_gpio_config;
- }
-
- rc = pm8058_kp_config_drv(pdata->rows_gpio_start,
- pdata->num_rows);
- if (rc < 0) {
- dev_err(&pdev->dev, "unable to configure keypad drive lines\n");
- goto err_gpio_config;
- }
-
- rc = request_threaded_irq(kp->key_sense_irq, NULL, pmic8058_kp_irq,
- IRQF_TRIGGER_RISING, "pmic-keypad", kp);
- if (rc < 0) {
- dev_err(&pdev->dev, "failed to request keypad sense irq\n");
- goto err_req_sense_irq;
- }
-
- rc = request_threaded_irq(kp->key_stuck_irq, NULL,
- pmic8058_kp_stuck_irq, IRQF_TRIGGER_RISING,
- "pmic-keypad-stuck", kp);
- if (rc < 0) {
- dev_err(&pdev->dev, "failed to request keypad stuck irq\n");
- goto err_req_stuck_irq;
- }
-
- rc = pmic8058_kp_read_u8(kp, &ctrl_val, KEYP_CTRL);
- ctrl_val |= KEYP_CTRL_KEYP_EN;
- rc = pmic8058_kp_write_u8(kp, ctrl_val, KEYP_CTRL);
-
- kp->ctrl_reg = ctrl_val;
-
- __dump_kp_regs(kp, "probe");
-
- rc = device_create_file(&pdev->dev, &dev_attr_disable_kp);
- if (rc < 0)
- goto err_create_file;
-
- device_init_wakeup(&pdev->dev, pdata->wakeup);
-
- return 0;
-
-err_create_file:
- free_irq(kp->key_stuck_irq, NULL);
-err_req_stuck_irq:
- free_irq(kp->key_sense_irq, NULL);
-err_req_sense_irq:
-err_gpio_config:
-err_kpd_init:
- input_unregister_device(kp->input);
- kp->input = NULL;
-err_get_irq:
- pm_runtime_set_suspended(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
- input_free_device(kp->input);
-err_alloc_device:
- kfree(keycodes);
-err_alloc_mem:
- kfree(kp);
- return rc;
-}
-
-static int __devexit pmic8058_kp_remove(struct platform_device *pdev)
-{
- struct pmic8058_kp *kp = platform_get_drvdata(pdev);
-
- pm_runtime_set_suspended(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
- device_remove_file(&pdev->dev, &dev_attr_disable_kp);
- device_init_wakeup(&pdev->dev, 0);
- free_irq(kp->key_stuck_irq, NULL);
- free_irq(kp->key_sense_irq, NULL);
- input_unregister_device(kp->input);
- platform_set_drvdata(pdev, NULL);
- kfree(kp->input->keycode);
- kfree(kp);
-
- return 0;
-}
-
-#ifdef CONFIG_PM
-static int pmic8058_kp_suspend(struct device *dev)
-{
- struct pmic8058_kp *kp = dev_get_drvdata(dev);
-
- if (device_may_wakeup(dev) && !pmic8058_kp_disabled(kp)) {
- enable_irq_wake(kp->key_sense_irq);
- } else {
- mutex_lock(&kp->mutex);
- pmic8058_kp_disable(kp);
- mutex_unlock(&kp->mutex);
- }
-
- return 0;
-}
-
-static int pmic8058_kp_resume(struct device *dev)
-{
- struct pmic8058_kp *kp = dev_get_drvdata(dev);
-
- if (device_may_wakeup(dev) && !pmic8058_kp_disabled(kp)) {
- disable_irq_wake(kp->key_sense_irq);
- } else {
- mutex_lock(&kp->mutex);
- pmic8058_kp_enable(kp);
- mutex_unlock(&kp->mutex);
- }
-
- return 0;
-}
-
-static struct dev_pm_ops pm8058_kp_pm_ops = {
- .suspend = pmic8058_kp_suspend,
- .resume = pmic8058_kp_resume,
-};
-#endif
-
-static struct platform_driver pmic8058_kp_driver = {
- .probe = pmic8058_kp_probe,
- .remove = __devexit_p(pmic8058_kp_remove),
- .driver = {
- .name = "pm8058-keypad",
- .owner = THIS_MODULE,
-#ifdef CONFIG_PM
- .pm = &pm8058_kp_pm_ops,
-#endif
- },
-};
-
-static int __init pmic8058_kp_init(void)
-{
- return platform_driver_register(&pmic8058_kp_driver);
-}
-module_init(pmic8058_kp_init);
-
-static void __exit pmic8058_kp_exit(void)
-{
- platform_driver_unregister(&pmic8058_kp_driver);
-}
-module_exit(pmic8058_kp_exit);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("PMIC8058 keypad driver");
-MODULE_VERSION("1.0");
-MODULE_ALIAS("platform:pmic8058_keypad");
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 9acebc0..d279a63 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -517,16 +517,6 @@
To compile this driver as a module, choose M here: the
module will be called xen-kbdfront.
-config PMIC8058_PWRKEY
- tristate "PMIC8058 power key support"
- default n
- depends on PMIC8058
- help
- Say Y here if you want support for the PMIC8058 power key.
-
- To compile this driver as a module, choose M here: the
- module will be called pmic8058-pwrkey.
-
config PMIC8058_OTHC
tristate "Qualcomm PMIC8058 OTHC support"
default n
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 770eb96..c5c4639 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -36,7 +36,6 @@
obj-$(CONFIG_INPUT_PMIC8XXX_PWRKEY) += pmic8xxx-pwrkey.o
obj-$(CONFIG_INPUT_POWERMATE) += powermate.o
obj-$(CONFIG_INPUT_PWM_BEEPER) += pwm-beeper.o
-obj-$(CONFIG_INPUT_PMIC8XXX_PWRKEY) += pmic8xxx-pwrkey.o
obj-$(CONFIG_INPUT_RB532_BUTTON) += rb532_button.o
obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER) += rotary_encoder.o
obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o
@@ -49,7 +48,6 @@
obj-$(CONFIG_INPUT_WM831X_ON) += wm831x-on.o
obj-$(CONFIG_INPUT_XEN_KBDDEV_FRONTEND) += xen-kbdfront.o
obj-$(CONFIG_INPUT_YEALINK) += yealink.o
-obj-$(CONFIG_PMIC8058_PWRKEY) += pmic8058-pwrkey.o
obj-$(CONFIG_PMIC8058_OTHC) += pmic8058-othc.o
obj-$(CONFIG_INPUT_PMIC8058_VIBRA_MEMLESS) += pmic8058-vib-memless.o
obj-$(CONFIG_BOSCH_BMA150) += bma150.o
diff --git a/drivers/input/misc/pmic8058-pwrkey.c b/drivers/input/misc/pmic8058-pwrkey.c
deleted file mode 100644
index a981013..0000000
--- a/drivers/input/misc/pmic8058-pwrkey.c
+++ /dev/null
@@ -1,375 +0,0 @@
-/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/input.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <linux/mfd/pmic8058.h>
-#include <linux/pmic8058-pwrkey.h>
-#include <linux/log2.h>
-#include <linux/spinlock.h>
-#include <linux/hrtimer.h>
-#include <linux/pm.h>
-#include <linux/slab.h>
-#include <linux/pm_runtime.h>
-
-#define PON_CNTL_1 0x1C
-#define PON_CNTL_PULL_UP BIT(7)
-#define PON_CNTL_TRIG_DELAY_MASK (0x7)
-
-struct pmic8058_pwrkey {
- struct input_dev *pwr;
- int key_press_irq;
- int key_release_irq;
- struct pm8058_chip *pm_chip;
- struct hrtimer timer;
- bool key_pressed;
- bool pressed_first;
- struct pmic8058_pwrkey_pdata *pdata;
- spinlock_t lock;
-};
-
-static enum hrtimer_restart pmic8058_pwrkey_timer(struct hrtimer *timer)
-{
- unsigned long flags;
- struct pmic8058_pwrkey *pwrkey = container_of(timer,
- struct pmic8058_pwrkey, timer);
-
- spin_lock_irqsave(&pwrkey->lock, flags);
- pwrkey->key_pressed = true;
-
- input_report_key(pwrkey->pwr, KEY_POWER, 1);
- input_sync(pwrkey->pwr);
- spin_unlock_irqrestore(&pwrkey->lock, flags);
-
- return HRTIMER_NORESTART;
-}
-
-static irqreturn_t pwrkey_press_irq(int irq, void *_pwrkey)
-{
- struct pmic8058_pwrkey *pwrkey = _pwrkey;
- struct pmic8058_pwrkey_pdata *pdata = pwrkey->pdata;
- unsigned long flags;
-
- spin_lock_irqsave(&pwrkey->lock, flags);
- if (pwrkey->pressed_first) {
- /*
- * If pressed_first flag is set already then release interrupt
- * has occured first. Events are handled in the release IRQ so
- * return.
- */
- pwrkey->pressed_first = false;
- spin_unlock_irqrestore(&pwrkey->lock, flags);
- return IRQ_HANDLED;
- } else {
- pwrkey->pressed_first = true;
- /*no pwrkey time duration, means no end key simulation*/
- if (!pwrkey->pdata->pwrkey_time_ms) {
- input_report_key(pwrkey->pwr, KEY_POWER, 1);
- input_sync(pwrkey->pwr);
- spin_unlock_irqrestore(&pwrkey->lock, flags);
- return IRQ_HANDLED;
- }
-
- input_report_key(pwrkey->pwr, KEY_END, 1);
- input_sync(pwrkey->pwr);
-
- hrtimer_start(&pwrkey->timer,
- ktime_set(pdata->pwrkey_time_ms / 1000,
- (pdata->pwrkey_time_ms % 1000) * 1000000),
- HRTIMER_MODE_REL);
- }
- spin_unlock_irqrestore(&pwrkey->lock, flags);
-
- return IRQ_HANDLED;
-}
-
-static irqreturn_t pwrkey_release_irq(int irq, void *_pwrkey)
-{
- struct pmic8058_pwrkey *pwrkey = _pwrkey;
- unsigned long flags;
-
- spin_lock_irqsave(&pwrkey->lock, flags);
- if (pwrkey->pressed_first) {
- pwrkey->pressed_first = false;
- /* no pwrkey time, means no delay in pwr key reporting */
- if (!pwrkey->pdata->pwrkey_time_ms) {
- input_report_key(pwrkey->pwr, KEY_POWER, 0);
- input_sync(pwrkey->pwr);
- spin_unlock_irqrestore(&pwrkey->lock, flags);
- return IRQ_HANDLED;
- }
-
- hrtimer_cancel(&pwrkey->timer);
-
- if (pwrkey->key_pressed) {
- pwrkey->key_pressed = false;
- input_report_key(pwrkey->pwr, KEY_POWER, 0);
- input_sync(pwrkey->pwr);
- }
-
- input_report_key(pwrkey->pwr, KEY_END, 0);
- input_sync(pwrkey->pwr);
- } else {
- /*
- * Set this flag true so that in the subsequent interrupt of
- * press we can know release interrupt came first
- */
- pwrkey->pressed_first = true;
- /* no pwrkey time, means no delay in pwr key reporting */
- if (!pwrkey->pdata->pwrkey_time_ms) {
- input_report_key(pwrkey->pwr, KEY_POWER, 1);
- input_sync(pwrkey->pwr);
- input_report_key(pwrkey->pwr, KEY_POWER, 0);
- input_sync(pwrkey->pwr);
- spin_unlock_irqrestore(&pwrkey->lock, flags);
- return IRQ_HANDLED;
- }
- input_report_key(pwrkey->pwr, KEY_END, 1);
- input_sync(pwrkey->pwr);
- input_report_key(pwrkey->pwr, KEY_END, 0);
- input_sync(pwrkey->pwr);
- }
- spin_unlock_irqrestore(&pwrkey->lock, flags);
-
- return IRQ_HANDLED;
-}
-
-#ifdef CONFIG_PM
-static int pmic8058_pwrkey_suspend(struct device *dev)
-{
- struct pmic8058_pwrkey *pwrkey = dev_get_drvdata(dev);
-
- if (device_may_wakeup(dev)) {
- enable_irq_wake(pwrkey->key_press_irq);
- enable_irq_wake(pwrkey->key_release_irq);
- }
-
- return 0;
-}
-
-static int pmic8058_pwrkey_resume(struct device *dev)
-{
- struct pmic8058_pwrkey *pwrkey = dev_get_drvdata(dev);
-
- if (device_may_wakeup(dev)) {
- disable_irq_wake(pwrkey->key_press_irq);
- disable_irq_wake(pwrkey->key_release_irq);
- }
-
- return 0;
-}
-
-static struct dev_pm_ops pm8058_pwr_key_pm_ops = {
- .suspend = pmic8058_pwrkey_suspend,
- .resume = pmic8058_pwrkey_resume,
-};
-#endif
-
-static int __devinit pmic8058_pwrkey_probe(struct platform_device *pdev)
-{
- struct input_dev *pwr;
- int key_release_irq = platform_get_irq(pdev, 0);
- int key_press_irq = platform_get_irq(pdev, 1);
- int err;
- unsigned int delay;
- u8 pon_cntl;
- struct pmic8058_pwrkey *pwrkey;
- struct pmic8058_pwrkey_pdata *pdata = pdev->dev.platform_data;
- struct pm8058_chip *pm_chip;
-
- pm_chip = dev_get_drvdata(pdev->dev.parent);
- if (pm_chip == NULL) {
- dev_err(&pdev->dev, "no parent data passed in\n");
- return -EFAULT;
- }
-
- if (!pdata) {
- dev_err(&pdev->dev, "power key platform data not supplied\n");
- return -EINVAL;
- }
-
- if (pdata->kpd_trigger_delay_us > 62500) {
- dev_err(&pdev->dev, "invalid pwr key trigger delay\n");
- return -EINVAL;
- }
-
- if (pdata->pwrkey_time_ms &&
- (pdata->pwrkey_time_ms < 500 || pdata->pwrkey_time_ms > 1000)) {
- dev_err(&pdev->dev, "invalid pwr key time supplied\n");
- return -EINVAL;
- }
-
- pwrkey = kzalloc(sizeof(*pwrkey), GFP_KERNEL);
- if (!pwrkey)
- return -ENOMEM;
-
- pwrkey->pm_chip = pm_chip;
- pwrkey->pdata = pdata;
- pwrkey->pressed_first = false;
- /* Enable runtime PM ops, start in ACTIVE mode */
- err = pm_runtime_set_active(&pdev->dev);
- if (err < 0)
- dev_dbg(&pdev->dev, "unable to set runtime pm state\n");
- pm_runtime_enable(&pdev->dev);
-
- pwr = input_allocate_device();
- if (!pwr) {
- dev_dbg(&pdev->dev, "Can't allocate power button\n");
- err = -ENOMEM;
- goto free_pwrkey;
- }
-
- input_set_capability(pwr, EV_KEY, KEY_POWER);
- input_set_capability(pwr, EV_KEY, KEY_END);
-
- pwr->name = "pmic8058_pwrkey";
- pwr->phys = "pmic8058_pwrkey/input0";
- pwr->dev.parent = &pdev->dev;
-
- delay = (pdata->kpd_trigger_delay_us << 10) / USEC_PER_SEC;
- delay = 1 + ilog2(delay);
-
- err = pm8058_read(pwrkey->pm_chip, PON_CNTL_1, &pon_cntl, 1);
- if (err < 0) {
- dev_err(&pdev->dev, "failed reading PON_CNTL_1 err=%d\n", err);
- goto free_input_dev;
- }
-
-
- pon_cntl &= ~PON_CNTL_TRIG_DELAY_MASK;
- pon_cntl |= (delay & PON_CNTL_TRIG_DELAY_MASK);
- pon_cntl |= (pdata->pull_up ? PON_CNTL_PULL_UP : ~PON_CNTL_PULL_UP);
- err = pm8058_write(pwrkey->pm_chip, PON_CNTL_1, &pon_cntl, 1);
- if (err < 0) {
- dev_err(&pdev->dev, "failed writing PON_CNTL_1 err=%d\n", err);
- goto free_input_dev;
- }
-
- hrtimer_init(&pwrkey->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
- pwrkey->timer.function = pmic8058_pwrkey_timer;
-
- spin_lock_init(&pwrkey->lock);
-
- err = input_register_device(pwr);
- if (err) {
- dev_dbg(&pdev->dev, "Can't register power key: %d\n", err);
- goto free_input_dev;
- }
-
- pwrkey->key_press_irq = key_press_irq;
- pwrkey->key_release_irq = key_release_irq;
- pwrkey->pwr = pwr;
-
- platform_set_drvdata(pdev, pwrkey);
-
- /* Check if power-key is pressed at boot up */
- err = pm8058_irq_get_rt_status(pwrkey->pm_chip, key_press_irq);
- if (err < 0) {
- dev_err(&pdev->dev, "Key-press status at boot failed rc=%d\n",
- err);
- goto unreg_input_dev;
- }
- if (err) {
- if (!pwrkey->pdata->pwrkey_time_ms)
- input_report_key(pwrkey->pwr, KEY_POWER, 1);
- else
- input_report_key(pwrkey->pwr, KEY_END, 1);
- input_sync(pwrkey->pwr);
- pwrkey->pressed_first = true;
- }
-
- err = request_threaded_irq(key_press_irq, NULL, pwrkey_press_irq,
- IRQF_TRIGGER_RISING, "pmic8058_pwrkey_press", pwrkey);
- if (err < 0) {
- dev_dbg(&pdev->dev, "Can't get %d IRQ for pwrkey: %d\n",
- key_press_irq, err);
- goto unreg_input_dev;
- }
-
- err = request_threaded_irq(key_release_irq, NULL, pwrkey_release_irq,
- IRQF_TRIGGER_RISING, "pmic8058_pwrkey_release",
- pwrkey);
- if (err < 0) {
- dev_dbg(&pdev->dev, "Can't get %d IRQ for pwrkey: %d\n",
- key_release_irq, err);
-
- goto free_press_irq;
- }
-
- device_init_wakeup(&pdev->dev, pdata->wakeup);
-
- return 0;
-
-free_press_irq:
- free_irq(key_press_irq, NULL);
-unreg_input_dev:
- input_unregister_device(pwr);
- pwr = NULL;
-free_input_dev:
- input_free_device(pwr);
-free_pwrkey:
- pm_runtime_set_suspended(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
- kfree(pwrkey);
- return err;
-}
-
-static int __devexit pmic8058_pwrkey_remove(struct platform_device *pdev)
-{
- struct pmic8058_pwrkey *pwrkey = platform_get_drvdata(pdev);
- int key_release_irq = platform_get_irq(pdev, 0);
- int key_press_irq = platform_get_irq(pdev, 1);
-
- pm_runtime_set_suspended(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
- device_init_wakeup(&pdev->dev, 0);
-
- free_irq(key_press_irq, pwrkey);
- free_irq(key_release_irq, pwrkey);
- input_unregister_device(pwrkey->pwr);
- kfree(pwrkey);
-
- return 0;
-}
-
-static struct platform_driver pmic8058_pwrkey_driver = {
- .probe = pmic8058_pwrkey_probe,
- .remove = __devexit_p(pmic8058_pwrkey_remove),
- .driver = {
- .name = "pm8058-pwrkey",
- .owner = THIS_MODULE,
-#ifdef CONFIG_PM
- .pm = &pm8058_pwr_key_pm_ops,
-#endif
- },
-};
-
-static int __init pmic8058_pwrkey_init(void)
-{
- return platform_driver_register(&pmic8058_pwrkey_driver);
-}
-module_init(pmic8058_pwrkey_init);
-
-static void __exit pmic8058_pwrkey_exit(void)
-{
- platform_driver_unregister(&pmic8058_pwrkey_driver);
-}
-module_exit(pmic8058_pwrkey_exit);
-
-MODULE_ALIAS("platform:pmic8058_pwrkey");
-MODULE_DESCRIPTION("PMIC8058 Power Key");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 88fa13a..43eb169 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -586,14 +586,6 @@
purposes including software controlled brightness of backlight,
motor control, and waveform generation.
-config PMIC8058_VIBRATOR
- tristate "Qualcomm PM8058 vibrator support"
- depends on PMIC8058 && ANDROID_TIMED_OUTPUT
- default n
- help
- This option enables device driver support for the vibrator
- on Qualcomm PM8058 chip.
-
config PMIC8XXX_VIBRATOR
tristate "Qualcomm Vibrator support for PMIC8XXX"
depends on MFD_PM8XXX && ANDROID_TIMED_OUTPUT
@@ -627,23 +619,6 @@
PMIC8058. Driver interface to program registers of the ADC over
AMUX channels, devices on programmable MPP's and xotherm.
-config PMIC8058_MISC
- tristate "Qualcomm PM8058 Misc Device driver"
- depends on PMIC8058
- default n
- help
- Provides functionality for various small drivers utilizing the
- Qualcomm PM8058 chip. Examples include: signalling when the 32kHz
- oscillator malfunctions.
-
-config PMIC8058_BATTALARM
- tristate "Qualcomm PM8058 Battery Alarm Device driver"
- depends on PMIC8058
- help
- This option enables support for the battery alarm module on the
- Qualcomm PM8058 PMIC chip. This support allows for configuration of
- the alarm module as well as interrupt handling.
-
config TZCOM
tristate "Trustzone Communicator driver"
default n
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index df35737..6b5fdcc 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -57,14 +57,11 @@
obj-$(CONFIG_TSPP) += tspp.o
obj-$(CONFIG_HAPTIC_ISA1200) += isa1200.o
obj-$(CONFIG_PMIC8058_PWM) += pmic8058-pwm.o
-obj-$(CONFIG_PMIC8058_VIBRATOR) += pmic8058-vibrator.o
obj-$(CONFIG_PMIC8XXX_VIBRATOR) += pm8xxx-vibrator.o
obj-$(CONFIG_PMIC8XXX_NFC) += pm8xxx-nfc.o
obj-$(CONFIG_PMIC8XXX_UPL) += pm8xxx-upl.o
obj-$(CONFIG_MSM_MEMORY_LOW_POWER_MODE_SUSPEND_DEEP_POWER_DOWN) \
+= msm_migrate_pages.o
obj-$(CONFIG_PMIC8058_XOADC) += pmic8058-xoadc.o
-obj-$(CONFIG_PMIC8058_MISC) += pmic8058-misc.o
-obj-$(CONFIG_PMIC8058_BATTALARM) += pmic8058-batt-alarm.o
obj-$(CONFIG_TZCOM) += tzcom.o
obj-$(CONFIG_QFP_FUSE) += qfp_fuse.o
diff --git a/drivers/misc/pmic8058-batt-alarm.c b/drivers/misc/pmic8058-batt-alarm.c
deleted file mode 100644
index bff0720..0000000
--- a/drivers/misc/pmic8058-batt-alarm.c
+++ /dev/null
@@ -1,753 +0,0 @@
-/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * 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.
- */
-/*
- * Qualcomm PMIC 8058 Battery Alarm Device driver
- *
- */
-
-#define pr_fmt(fmt) "%s: " fmt, __func__
-
-#include <linux/err.h>
-#include <linux/interrupt.h>
-#include <linux/module.h>
-#include <linux/notifier.h>
-#include <linux/platform_device.h>
-#include <linux/slab.h>
-#include <linux/pmic8058-batt-alarm.h>
-#include <linux/mfd/pmic8058.h>
-
-/* PMIC 8058 Battery Alarm SSBI registers */
-#define REG_THRESHOLD 0x023
-#define REG_CTRL1 0x024
-#define REG_CTRL2 0x0AA
-#define REG_PWM_CTRL 0x0A3
-
-/* Available voltage threshold values */
-#define THRESHOLD_MIN_MV 2500
-#define THRESHOLD_MAX_MV 5675
-#define THRESHOLD_STEP_MV 25
-
-/* Register bit definitions */
-
-/* Threshold register */
-#define THRESHOLD_UPPER_MASK 0xF0
-#define THRESHOLD_LOWER_MASK 0x0F
-#define THRESHOLD_UPPER_SHIFT 4
-#define THRESHOLD_LOWER_SHIFT 0
-
-/* CTRL 1 register */
-#define CTRL1_BATT_ALARM_EN_MASK 0x80
-#define CTRL1_HOLD_TIME_MASK 0x70
-#define CTRL1_STATUS_UPPER_MASK 0x02
-#define CTRL1_STATUS_LOWER_MASK 0x01
-#define CTRL1_HOLD_TIME_SHIFT 4
-#define CTRL1_HOLD_TIME_MIN 0
-#define CTRL1_HOLD_TIME_MAX 7
-
-/* CTRL 2 register */
-#define CTRL2_COMP_UPPER_DISABLE_MASK 0x80
-#define CTRL2_COMP_LOWER_DISABLE_MASK 0x40
-#define CTRL2_FINE_STEP_UPPER_MASK 0x30
-#define CTRL2_RANGE_EXT_UPPER_MASK 0x08
-#define CTRL2_FINE_STEP_LOWER_MASK 0x06
-#define CTRL2_RANGE_EXT_LOWER_MASK 0x01
-#define CTRL2_FINE_STEP_UPPER_SHIFT 4
-#define CTRL2_FINE_STEP_LOWER_SHIFT 1
-
-/* PWM control register */
-#define PWM_CTRL_ALARM_EN_MASK 0xC0
-#define PWM_CTRL_ALARM_EN_NEVER 0x00
-#define PWM_CTRL_ALARM_EN_TCXO 0x40
-#define PWM_CTRL_ALARM_EN_PWM 0x80
-#define PWM_CTRL_ALARM_EN_ALWAYS 0xC0
-#define PWM_CTRL_PRE_MASK 0x38
-#define PWM_CTRL_DIV_MASK 0x07
-#define PWM_CTRL_PRE_SHIFT 3
-#define PWM_CTRL_DIV_SHIFT 0
-#define PWM_CTRL_PRE_MIN 0
-#define PWM_CTRL_PRE_MAX 7
-#define PWM_CTRL_DIV_MIN 1
-#define PWM_CTRL_DIV_MAX 7
-
-/* PWM control input range */
-#define PWM_CTRL_PRE_INPUT_MIN 2
-#define PWM_CTRL_PRE_INPUT_MAX 9
-#define PWM_CTRL_DIV_INPUT_MIN 2
-#define PWM_CTRL_DIV_INPUT_MAX 8
-
-/* Available voltage threshold values */
-#define THRESHOLD_BASIC_MIN_MV 2800
-#define THRESHOLD_EXT_MIN_MV 4400
-
-/*
- * Default values used during initialization:
- * Slowest PWM rate to ensure minimal status jittering when crossing thresholds.
- * Largest hold time also helps reduce status value jittering. Comparators
- * are disabled by default and must be turned on by calling
- * pm8058_batt_alarm_state_set.
- */
-#define DEFAULT_THRESHOLD_LOWER 3200
-#define DEFAULT_THRESHOLD_UPPER 4300
-#define DEFAULT_HOLD_TIME PM8058_BATT_ALARM_HOLD_TIME_16_MS
-#define DEFAULT_USE_PWM 1
-#define DEFAULT_PWM_SCALER 9
-#define DEFAULT_PWM_DIVIDER 8
-#define DEFAULT_LOWER_ENABLE 0
-#define DEFAULT_UPPER_ENABLE 0
-
-struct pm8058_batt_alarm_device {
- struct srcu_notifier_head irq_notifier_list;
- struct pm8058_chip *pm_chip;
- struct mutex batt_mutex;
- unsigned int irq;
- int notifier_count;
- u8 reg_threshold;
- u8 reg_ctrl1;
- u8 reg_ctrl2;
- u8 reg_pwm_ctrl;
-};
-static struct pm8058_batt_alarm_device *the_battalarm;
-
-static int pm8058_reg_write(struct pm8058_chip *chip, u16 addr, u8 val, u8 mask,
- u8 *reg_save)
-{
- int rc = 0;
- u8 reg;
-
- reg = (*reg_save & ~mask) | (val & mask);
- if (reg != *reg_save)
- rc = pm8058_write(chip, addr, ®, 1);
- if (rc)
- pr_err("pm8058_write failed; addr=%03X, rc=%d\n", addr, rc);
- else
- *reg_save = reg;
- return rc;
-}
-
-/**
- * pm8058_batt_alarm_state_set - enable or disable the threshold comparators
- * @enable_lower_comparator: 1 = enable comparator, 0 = disable comparator
- * @enable_upper_comparator: 1 = enable comparator, 0 = disable comparator
- *
- * RETURNS: an appropriate -ERRNO error value on error, or zero for success.
- */
-int pm8058_batt_alarm_state_set(int enable_lower_comparator,
- int enable_upper_comparator)
-{
- struct pm8058_batt_alarm_device *battdev = the_battalarm;
- int rc;
- u8 reg_ctrl1 = 0, reg_ctrl2 = 0;
-
- if (!battdev) {
- pr_err("no battery alarm device found.\n");
- return -ENXIO;
- }
-
- if (!enable_lower_comparator)
- reg_ctrl2 |= CTRL2_COMP_LOWER_DISABLE_MASK;
- if (!enable_upper_comparator)
- reg_ctrl2 |= CTRL2_COMP_UPPER_DISABLE_MASK;
-
- if (enable_lower_comparator || enable_upper_comparator)
- reg_ctrl1 = CTRL1_BATT_ALARM_EN_MASK;
-
- mutex_lock(&battdev->batt_mutex);
- rc = pm8058_reg_write(battdev->pm_chip, REG_CTRL1, reg_ctrl1,
- CTRL1_BATT_ALARM_EN_MASK, &battdev->reg_ctrl1);
- if (rc)
- goto bail;
-
- rc = pm8058_reg_write(battdev->pm_chip, REG_CTRL2, reg_ctrl2,
- CTRL2_COMP_LOWER_DISABLE_MASK | CTRL2_COMP_UPPER_DISABLE_MASK,
- &battdev->reg_ctrl2);
-
-bail:
- mutex_unlock(&battdev->batt_mutex);
- return rc;
-}
-EXPORT_SYMBOL_GPL(pm8058_batt_alarm_state_set);
-
-/**
- * pm8058_batt_alarm_threshold_set - set the lower and upper alarm thresholds
- * @lower_threshold_mV: battery undervoltage threshold in millivolts
- * @upper_threshold_mV: battery overvoltage threshold in millivolts
- *
- * RETURNS: an appropriate -ERRNO error value on error, or zero for success.
- */
-int pm8058_batt_alarm_threshold_set(int lower_threshold_mV,
- int upper_threshold_mV)
-{
- struct pm8058_batt_alarm_device *battdev = the_battalarm;
- int step, fine_step, rc;
- u8 reg_threshold = 0, reg_ctrl2 = 0;
-
- if (!battdev) {
- pr_err("no battery alarm device found.\n");
- return -ENXIO;
- }
-
- if (lower_threshold_mV < THRESHOLD_MIN_MV
- || lower_threshold_mV > THRESHOLD_MAX_MV) {
- pr_err("lower threshold value, %d mV, is outside of allowable "
- "range: [%d, %d] mV\n", lower_threshold_mV,
- THRESHOLD_MIN_MV, THRESHOLD_MAX_MV);
- return -EINVAL;
- }
-
- if (upper_threshold_mV < THRESHOLD_MIN_MV
- || upper_threshold_mV > THRESHOLD_MAX_MV) {
- pr_err("upper threshold value, %d mV, is outside of allowable "
- "range: [%d, %d] mV\n", upper_threshold_mV,
- THRESHOLD_MIN_MV, THRESHOLD_MAX_MV);
- return -EINVAL;
- }
-
- if (upper_threshold_mV < lower_threshold_mV) {
- pr_err("lower threshold value, %d mV, must be <= upper "
- "threshold value, %d mV\n", lower_threshold_mV,
- upper_threshold_mV);
- return -EINVAL;
- }
-
- /* Determine register settings for lower threshold. */
- if (lower_threshold_mV < THRESHOLD_BASIC_MIN_MV) {
- /* Extended low range */
- reg_ctrl2 |= CTRL2_RANGE_EXT_LOWER_MASK;
-
- step = (lower_threshold_mV - THRESHOLD_MIN_MV)
- / THRESHOLD_STEP_MV;
-
- fine_step = step & 0x3;
- /* Extended low range is for steps 0 to 2 */
- step >>= 2;
-
- reg_threshold |= (step << THRESHOLD_LOWER_SHIFT)
- & THRESHOLD_LOWER_MASK;
- reg_ctrl2 |= (fine_step << CTRL2_FINE_STEP_LOWER_SHIFT)
- & CTRL2_FINE_STEP_LOWER_MASK;
- } else if (lower_threshold_mV >= THRESHOLD_EXT_MIN_MV) {
- /* Extended high range */
- reg_ctrl2 |= CTRL2_RANGE_EXT_LOWER_MASK;
-
- step = (lower_threshold_mV - THRESHOLD_EXT_MIN_MV)
- / THRESHOLD_STEP_MV;
-
- fine_step = step & 0x3;
- /* Extended high range is for steps 3 to 15 */
- step = (step >> 2) + 3;
-
- reg_threshold |= (step << THRESHOLD_LOWER_SHIFT)
- & THRESHOLD_LOWER_MASK;
- reg_ctrl2 |= (fine_step << CTRL2_FINE_STEP_LOWER_SHIFT)
- & CTRL2_FINE_STEP_LOWER_MASK;
- } else {
- /* Basic range */
- step = (lower_threshold_mV - THRESHOLD_BASIC_MIN_MV)
- / THRESHOLD_STEP_MV;
-
- fine_step = step & 0x3;
- step >>= 2;
-
- reg_threshold |= (step << THRESHOLD_LOWER_SHIFT)
- & THRESHOLD_LOWER_MASK;
- reg_ctrl2 |= (fine_step << CTRL2_FINE_STEP_LOWER_SHIFT)
- & CTRL2_FINE_STEP_LOWER_MASK;
- }
-
- /* Determine register settings for upper threshold. */
- if (upper_threshold_mV < THRESHOLD_BASIC_MIN_MV) {
- /* Extended low range */
- reg_ctrl2 |= CTRL2_RANGE_EXT_UPPER_MASK;
-
- step = (upper_threshold_mV - THRESHOLD_MIN_MV)
- / THRESHOLD_STEP_MV;
-
- fine_step = step & 0x3;
- /* Extended low range is for steps 0 to 2 */
- step >>= 2;
-
- reg_threshold |= (step << THRESHOLD_UPPER_SHIFT)
- & THRESHOLD_UPPER_MASK;
- reg_ctrl2 |= (fine_step << CTRL2_FINE_STEP_UPPER_SHIFT)
- & CTRL2_FINE_STEP_UPPER_MASK;
- } else if (upper_threshold_mV >= THRESHOLD_EXT_MIN_MV) {
- /* Extended high range */
- reg_ctrl2 |= CTRL2_RANGE_EXT_UPPER_MASK;
-
- step = (upper_threshold_mV - THRESHOLD_EXT_MIN_MV)
- / THRESHOLD_STEP_MV;
-
- fine_step = step & 0x3;
- /* Extended high range is for steps 3 to 15 */
- step = (step >> 2) + 3;
-
- reg_threshold |= (step << THRESHOLD_UPPER_SHIFT)
- & THRESHOLD_UPPER_MASK;
- reg_ctrl2 |= (fine_step << CTRL2_FINE_STEP_UPPER_SHIFT)
- & CTRL2_FINE_STEP_UPPER_MASK;
- } else {
- /* Basic range */
- step = (upper_threshold_mV - THRESHOLD_BASIC_MIN_MV)
- / THRESHOLD_STEP_MV;
-
- fine_step = step & 0x3;
- step >>= 2;
-
- reg_threshold |= (step << THRESHOLD_UPPER_SHIFT)
- & THRESHOLD_UPPER_MASK;
- reg_ctrl2 |= (fine_step << CTRL2_FINE_STEP_UPPER_SHIFT)
- & CTRL2_FINE_STEP_UPPER_MASK;
- }
-
- mutex_lock(&battdev->batt_mutex);
- rc = pm8058_reg_write(battdev->pm_chip, REG_THRESHOLD, reg_threshold,
- THRESHOLD_LOWER_MASK | THRESHOLD_UPPER_MASK,
- &battdev->reg_threshold);
- if (rc)
- goto bail;
-
- rc = pm8058_reg_write(battdev->pm_chip, REG_CTRL2, reg_ctrl2,
- CTRL2_FINE_STEP_LOWER_MASK | CTRL2_FINE_STEP_UPPER_MASK
- | CTRL2_RANGE_EXT_LOWER_MASK | CTRL2_RANGE_EXT_UPPER_MASK,
- &battdev->reg_ctrl2);
-
-bail:
- mutex_unlock(&battdev->batt_mutex);
- return rc;
-}
-EXPORT_SYMBOL_GPL(pm8058_batt_alarm_threshold_set);
-
-/**
- * pm8058_batt_alarm_status_read - get status of both threshold comparators
- *
- * RETURNS: < 0 = error
- * 0 = battery voltage ok
- * BIT(0) set = battery voltage below lower threshold
- * BIT(1) set = battery voltage above upper threshold
- */
-int pm8058_batt_alarm_status_read(void)
-{
- struct pm8058_batt_alarm_device *battdev = the_battalarm;
- int status, rc;
-
- if (!battdev) {
- pr_err("no battery alarm device found.\n");
- return -ENXIO;
- }
-
- mutex_lock(&battdev->batt_mutex);
- rc = pm8058_read(battdev->pm_chip, REG_CTRL1, &battdev->reg_ctrl1, 1);
-
- status = ((battdev->reg_ctrl1 & CTRL1_STATUS_LOWER_MASK)
- ? PM8058_BATT_ALARM_STATUS_BELOW_LOWER : 0)
- | ((battdev->reg_ctrl1 & CTRL1_STATUS_UPPER_MASK)
- ? PM8058_BATT_ALARM_STATUS_ABOVE_UPPER : 0);
- mutex_unlock(&battdev->batt_mutex);
-
- if (rc) {
- pr_err("pm8058_read failed, rc=%d\n", rc);
- return rc;
- }
-
- return status;
-}
-EXPORT_SYMBOL_GPL(pm8058_batt_alarm_status_read);
-
-/**
- * pm8058_batt_alarm_hold_time_set - set hold time of interrupt output *
- * @hold_time: amount of time that battery voltage must remain outside of the
- * threshold range before the battery alarm interrupt triggers
- *
- * RETURNS: an appropriate -ERRNO error value on error, or zero for success.
- */
-int pm8058_batt_alarm_hold_time_set(enum pm8058_batt_alarm_hold_time hold_time)
-{
- struct pm8058_batt_alarm_device *battdev = the_battalarm;
- int rc;
- u8 reg_ctrl1 = 0;
-
- if (!battdev) {
- pr_err("no battery alarm device found.\n");
- return -ENXIO;
- }
-
- if (hold_time < CTRL1_HOLD_TIME_MIN
- || hold_time > CTRL1_HOLD_TIME_MAX) {
-
- pr_err("hold time, %d, is outside of allowable range: "
- "[%d, %d]\n", hold_time, CTRL1_HOLD_TIME_MIN,
- CTRL1_HOLD_TIME_MAX);
- return -EINVAL;
- }
-
- reg_ctrl1 = hold_time << CTRL1_HOLD_TIME_SHIFT;
-
- mutex_lock(&battdev->batt_mutex);
- rc = pm8058_reg_write(battdev->pm_chip, REG_CTRL1, reg_ctrl1,
- CTRL1_HOLD_TIME_MASK, &battdev->reg_ctrl1);
- mutex_unlock(&battdev->batt_mutex);
-
- return rc;
-}
-EXPORT_SYMBOL_GPL(pm8058_batt_alarm_hold_time_set);
-
-/**
- * pm8058_batt_alarm_pwm_rate_set - set battery alarm update rate *
- * @use_pwm: 1 = use PWM update rate, 0 = comparators always active
- * @clock_scaler: PWM clock scaler = 2 to 9
- * @clock_divider: PWM clock divider = 2 to 8
- *
- * This function sets the rate at which the battery alarm module enables
- * the threshold comparators. The rate is determined by the following equation:
- *
- * f_update = (1024 Hz) / (clock_divider * (2 ^ clock_scaler))
- *
- * Thus, the update rate can range from 0.25 Hz to 128 Hz.
- *
- * RETURNS: an appropriate -ERRNO error value on error, or zero for success.
- */
-int pm8058_batt_alarm_pwm_rate_set(int use_pwm, int clock_scaler,
- int clock_divider)
-{
- struct pm8058_batt_alarm_device *battdev = the_battalarm;
- int rc;
- u8 reg_pwm_ctrl = 0, mask = 0;
-
- if (!battdev) {
- pr_err("no battery alarm device found.\n");
- return -ENXIO;
- }
-
- if (use_pwm && (clock_scaler < PWM_CTRL_PRE_INPUT_MIN
- || clock_scaler > PWM_CTRL_PRE_INPUT_MAX)) {
- pr_err("PWM clock scaler, %d, is outside of allowable range: "
- "[%d, %d]\n", clock_scaler, PWM_CTRL_PRE_INPUT_MIN,
- PWM_CTRL_PRE_INPUT_MAX);
- return -EINVAL;
- }
-
- if (use_pwm && (clock_divider < PWM_CTRL_DIV_INPUT_MIN
- || clock_divider > PWM_CTRL_DIV_INPUT_MAX)) {
- pr_err("PWM clock divider, %d, is outside of allowable range: "
- "[%d, %d]\n", clock_divider, PWM_CTRL_DIV_INPUT_MIN,
- PWM_CTRL_DIV_INPUT_MAX);
- return -EINVAL;
- }
-
- if (!use_pwm) {
- /* Turn off PWM control and always enable. */
- reg_pwm_ctrl = PWM_CTRL_ALARM_EN_ALWAYS;
- mask = PWM_CTRL_ALARM_EN_MASK;
- } else {
- /* Use PWM control. */
- reg_pwm_ctrl = PWM_CTRL_ALARM_EN_PWM;
- mask = PWM_CTRL_ALARM_EN_MASK | PWM_CTRL_PRE_MASK
- | PWM_CTRL_DIV_MASK;
-
- clock_scaler -= PWM_CTRL_PRE_INPUT_MIN - PWM_CTRL_PRE_MIN;
- clock_divider -= PWM_CTRL_DIV_INPUT_MIN - PWM_CTRL_DIV_MIN;
-
- reg_pwm_ctrl |= (clock_scaler << PWM_CTRL_PRE_SHIFT)
- & PWM_CTRL_PRE_MASK;
- reg_pwm_ctrl |= (clock_divider << PWM_CTRL_DIV_SHIFT)
- & PWM_CTRL_DIV_MASK;
- }
-
- mutex_lock(&battdev->batt_mutex);
- rc = pm8058_reg_write(battdev->pm_chip, REG_PWM_CTRL, reg_pwm_ctrl,
- mask, &battdev->reg_pwm_ctrl);
- mutex_unlock(&battdev->batt_mutex);
-
- return rc;
-}
-EXPORT_SYMBOL_GPL(pm8058_batt_alarm_pwm_rate_set);
-
-/*
- * Handle the BATT_ALARM interrupt:
- * Battery voltage is above or below threshold range.
- */
-static irqreturn_t pm8058_batt_alarm_isr(int irq, void *data)
-{
- struct pm8058_batt_alarm_device *battdev = data;
- int status;
-
- if (battdev) {
- status = pm8058_batt_alarm_status_read();
-
- if (status < 0)
- pr_err("failed to read status, rc=%d\n", status);
- else
- srcu_notifier_call_chain(&battdev->irq_notifier_list,
- status, NULL);
- }
-
- return IRQ_HANDLED;
-}
-
-/**
- * pm8058_batt_alarm_register_notifier - register a notifier to run when a
- * battery voltage change interrupt fires
- * @nb: notifier block containing callback function to register
- *
- * nb->notifier_call must point to a function of this form -
- * int (*notifier_call)(struct notifier_block *nb, unsigned long status,
- * void *unused);
- * "status" will receive the battery alarm status; "unused" will be NULL.
- *
- * RETURNS: an appropriate -ERRNO error value on error, or zero for success.
- */
-int pm8058_batt_alarm_register_notifier(struct notifier_block *nb)
-{
- int rc;
-
- if (!the_battalarm) {
- pr_err("no battery alarm device found.\n");
- return -ENXIO;
- }
-
- rc = srcu_notifier_chain_register(&the_battalarm->irq_notifier_list,
- nb);
- mutex_lock(&the_battalarm->batt_mutex);
- if (rc == 0) {
- if (the_battalarm->notifier_count == 0) {
- /* request the irq */
- rc = request_threaded_irq(the_battalarm->irq, NULL,
- pm8058_batt_alarm_isr,
- IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
- "pm8058-batt_alarm-irq", the_battalarm);
- if (rc < 0) {
- pr_err("request_irq(%d) failed, rc=%d\n",
- the_battalarm->irq, rc);
- goto done;
- }
-
- rc = irq_set_irq_wake(the_battalarm->irq, 1);
- if (rc < 0) {
- pr_err("irq_set_irq_wake(%d,1) failed, rc=%d\n",
- the_battalarm->irq, rc);
- goto done;
- }
- }
-
- the_battalarm->notifier_count++;
- }
-done:
- mutex_unlock(&the_battalarm->batt_mutex);
- return rc;
-}
-EXPORT_SYMBOL_GPL(pm8058_batt_alarm_register_notifier);
-
-/**
- * pm8058_batt_alarm_unregister_notifier - unregister a notifier that is run
- * when a battery voltage change interrupt fires
- * @nb: notifier block containing callback function to unregister
- *
- * RETURNS: an appropriate -ERRNO error value on error, or zero for success.
- */
-int pm8058_batt_alarm_unregister_notifier(struct notifier_block *nb)
-{
- int rc;
-
- if (!the_battalarm) {
- pr_err("no battery alarm device found.\n");
- return -ENXIO;
- }
-
- rc = srcu_notifier_chain_unregister(&the_battalarm->irq_notifier_list,
- nb);
- if (rc == 0) {
- mutex_lock(&the_battalarm->batt_mutex);
-
- the_battalarm->notifier_count--;
-
- if (the_battalarm->notifier_count == 0)
- free_irq(the_battalarm->irq, the_battalarm);
-
- WARN_ON(the_battalarm->notifier_count < 0);
-
- mutex_unlock(&the_battalarm->batt_mutex);
- }
-
-
-
- return rc;
-}
-EXPORT_SYMBOL_GPL(pm8058_batt_alarm_unregister_notifier);
-
-static int pm8058_batt_alarm_reg_init(struct pm8058_batt_alarm_device *battdev)
-{
- int rc = 0;
-
- /* save the current register states */
- rc = pm8058_read(battdev->pm_chip, REG_THRESHOLD,
- &battdev->reg_threshold, 1);
- if (rc)
- goto bail;
-
- rc = pm8058_read(battdev->pm_chip, REG_CTRL1,
- &battdev->reg_ctrl1, 1);
- if (rc)
- goto bail;
-
- rc = pm8058_read(battdev->pm_chip, REG_CTRL2,
- &battdev->reg_ctrl2, 1);
- if (rc)
- goto bail;
-
- rc = pm8058_read(battdev->pm_chip, REG_PWM_CTRL,
- &battdev->reg_pwm_ctrl, 1);
- if (rc)
- goto bail;
-
-bail:
- if (rc)
- pr_err("pm8058_read failed; initial register states "
- "unknown, rc=%d\n", rc);
- return rc;
-}
-
-static int pm8058_batt_alarm_config(void)
-{
- int rc = 0;
-
- /* Use default values when no platform data is provided. */
- rc = pm8058_batt_alarm_threshold_set(DEFAULT_THRESHOLD_LOWER,
- DEFAULT_THRESHOLD_UPPER);
- if (rc) {
- pr_err("threshold_set failed, rc=%d\n", rc);
- goto done;
- }
-
- rc = pm8058_batt_alarm_hold_time_set(DEFAULT_HOLD_TIME);
- if (rc) {
- pr_err("hold_time_set failed, rc=%d\n", rc);
- goto done;
- }
-
- rc = pm8058_batt_alarm_pwm_rate_set(DEFAULT_USE_PWM,
- DEFAULT_PWM_SCALER, DEFAULT_PWM_DIVIDER);
- if (rc) {
- pr_err("pwm_rate_set failed, rc=%d\n", rc);
- goto done;
- }
-
- rc = pm8058_batt_alarm_state_set(DEFAULT_LOWER_ENABLE,
- DEFAULT_UPPER_ENABLE);
- if (rc) {
- pr_err("state_set failed, rc=%d\n", rc);
- goto done;
- }
-
-done:
- return rc;
-}
-
-static int __devinit pm8058_batt_alarm_probe(struct platform_device *pdev)
-{
- struct pm8058_batt_alarm_device *battdev;
- struct pm8058_chip *pm_chip;
- unsigned int irq;
- int rc;
-
- pm_chip = dev_get_drvdata(pdev->dev.parent);
- if (pm_chip == NULL) {
- pr_err("no driver data passed in.\n");
- rc = -EFAULT;
- goto exit_input;
- }
-
- irq = platform_get_irq(pdev, 0);
- if (!irq) {
- pr_err("no IRQ passed in.\n");
- rc = -EFAULT;
- goto exit_input;
- }
-
- battdev = kzalloc(sizeof *battdev, GFP_KERNEL);
- if (battdev == NULL) {
- pr_err("kzalloc() failed.\n");
- rc = -ENOMEM;
- goto exit_input;
- }
-
- battdev->pm_chip = pm_chip;
- platform_set_drvdata(pdev, battdev);
-
- srcu_init_notifier_head(&battdev->irq_notifier_list);
-
- battdev->irq = irq;
- battdev->notifier_count = 0;
- mutex_init(&battdev->batt_mutex);
-
- rc = pm8058_batt_alarm_reg_init(battdev);
- if (rc)
- goto exit_free_dev;
-
- the_battalarm = battdev;
-
- rc = pm8058_batt_alarm_config();
- if (rc)
- goto exit_free_dev;
-
- pr_notice("OK\n");
- return 0;
-
-exit_free_dev:
- mutex_destroy(&battdev->batt_mutex);
- srcu_cleanup_notifier_head(&battdev->irq_notifier_list);
- platform_set_drvdata(pdev, battdev->pm_chip);
- kfree(battdev);
-exit_input:
- return rc;
-}
-
-static int __devexit pm8058_batt_alarm_remove(struct platform_device *pdev)
-{
- struct pm8058_batt_alarm_device *battdev = platform_get_drvdata(pdev);
-
- mutex_destroy(&battdev->batt_mutex);
- srcu_cleanup_notifier_head(&battdev->irq_notifier_list);
- platform_set_drvdata(pdev, battdev->pm_chip);
- free_irq(battdev->irq, battdev);
- kfree(battdev);
-
- the_battalarm = NULL;
-
- return 0;
-}
-
-static struct platform_driver pm8058_batt_alarm_driver = {
- .probe = pm8058_batt_alarm_probe,
- .remove = __devexit_p(pm8058_batt_alarm_remove),
- .driver = {
- .name = "pm8058-batt-alarm",
- .owner = THIS_MODULE,
- },
-};
-
-static int __init pm8058_batt_alarm_init(void)
-{
- return platform_driver_register(&pm8058_batt_alarm_driver);
-}
-
-static void __exit pm8058_batt_alarm_exit(void)
-{
- platform_driver_unregister(&pm8058_batt_alarm_driver);
-}
-
-module_init(pm8058_batt_alarm_init);
-module_exit(pm8058_batt_alarm_exit);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("PMIC8058 Battery Alarm Device driver");
-MODULE_VERSION("1.0");
-MODULE_ALIAS("platform:pm8058-batt-alarm");
diff --git a/drivers/misc/pmic8058-misc.c b/drivers/misc/pmic8058-misc.c
deleted file mode 100644
index 77a2f47..0000000
--- a/drivers/misc/pmic8058-misc.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * 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.
- *
- */
-/*
- * Qualcomm PMIC8058 Misc Device driver
- *
- */
-
-#include <linux/debugfs.h>
-#include <linux/err.h>
-#include <linux/interrupt.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/slab.h>
-#include <linux/mfd/pmic8058.h>
-#include <linux/pmic8058-misc.h>
-
-/* VIB_DRV register */
-#define SSBI_REG_ADDR_DRV_VIB 0x4A
-
-#define PM8058_VIB_DRIVE_SHIFT 3
-#define PM8058_VIB_LOGIC_SHIFT 2
-#define PM8058_VIB_MIN_LEVEL_mV 1200
-#define PM8058_VIB_MAX_LEVEL_mV 3100
-
-/* COINCELL_CHG register */
-#define SSBI_REG_ADDR_COINCELL_CHG (0x2F)
-#define PM8058_COINCELL_RESISTOR_SHIFT (2)
-
-/* Resource offsets. */
-enum PM8058_MISC_IRQ {
- PM8058_MISC_IRQ_OSC_HALT = 0
-};
-
-struct pm8058_misc_device {
- struct pm8058_chip *pm_chip;
- struct dentry *dgb_dir;
- unsigned int osc_halt_irq;
- u64 osc_halt_count;
-};
-
-static struct pm8058_misc_device *misc_dev;
-
-int pm8058_vibrator_config(struct pm8058_vib_config *vib_config)
-{
- u8 reg = 0;
- int rc;
-
- if (misc_dev == NULL) {
- pr_info("misc_device is NULL\n");
- return -EINVAL;
- }
-
- if (vib_config->drive_mV) {
- if (vib_config->drive_mV < PM8058_VIB_MIN_LEVEL_mV ||
- vib_config->drive_mV > PM8058_VIB_MAX_LEVEL_mV) {
- pr_err("Invalid vibrator drive strength\n");
- return -EINVAL;
- }
- }
-
- reg = (vib_config->drive_mV / 100) << PM8058_VIB_DRIVE_SHIFT;
-
- reg |= (!!vib_config->active_low) << PM8058_VIB_LOGIC_SHIFT;
-
- reg |= vib_config->enable_mode;
-
- rc = pm8058_write(misc_dev->pm_chip, SSBI_REG_ADDR_DRV_VIB, ®, 1);
- if (rc)
- pr_err("%s: pm8058 write failed: rc=%d\n", __func__, rc);
-
- return rc;
-}
-EXPORT_SYMBOL(pm8058_vibrator_config);
-
-/**
- * pm8058_coincell_chg_config - Disables or enables the coincell charger, and
- * configures its voltage and resistor settings.
- * @chg_config: Holds both voltage and resistor values, and a
- * switch to change the state of charger.
- * If state is to disable the charger then
- * both voltage and resistor are disregarded.
- *
- * RETURNS: an appropriate -ERRNO error value on error, or zero for success.
- */
-int pm8058_coincell_chg_config(struct pm8058_coincell_chg_config *chg_config)
-{
- u8 reg, voltage, resistor;
- int rc;
-
- reg = 0;
- voltage = 0;
- resistor = 0;
- rc = 0;
-
- if (misc_dev == NULL) {
- pr_err("misc_device is NULL\n");
- return -EINVAL;
- }
-
- if (chg_config == NULL) {
- pr_err("chg_config is NULL\n");
- return -EINVAL;
- }
-
- if (chg_config->state == PM8058_COINCELL_CHG_DISABLE) {
- rc = pm8058_write(misc_dev->pm_chip,
- SSBI_REG_ADDR_COINCELL_CHG, ®, 1);
- if (rc)
- pr_err("%s: pm8058 write failed: rc=%d\n",
- __func__, rc);
- return rc;
- }
-
- voltage = chg_config->voltage;
- resistor = chg_config->resistor;
-
- if (voltage < PM8058_COINCELL_VOLTAGE_3p2V ||
- (voltage > PM8058_COINCELL_VOLTAGE_3p0V &&
- voltage != PM8058_COINCELL_VOLTAGE_2p5V)) {
- pr_err("Invalid voltage value provided\n");
- return -EINVAL;
- }
-
- if (resistor < PM8058_COINCELL_RESISTOR_2100_OHMS ||
- resistor > PM8058_COINCELL_RESISTOR_800_OHMS) {
- pr_err("Invalid resistor value provided\n");
- return -EINVAL;
- }
-
- reg |= voltage;
-
- reg |= (resistor << PM8058_COINCELL_RESISTOR_SHIFT);
-
- rc = pm8058_write(misc_dev->pm_chip,
- SSBI_REG_ADDR_COINCELL_CHG, ®, 1);
-
- if (rc)
- pr_err("%s: pm8058 write failed: rc=%d\n", __func__, rc);
-
- return rc;
-}
-EXPORT_SYMBOL(pm8058_coincell_chg_config);
-
-/* Handle the OSC_HALT interrupt: 32 kHz XTAL oscillator has stopped. */
-static irqreturn_t pm8058_osc_halt_isr(int irq, void *data)
-{
- struct pm8058_misc_device *miscdev = data;
- u64 count = 0;
-
- if (miscdev) {
- miscdev->osc_halt_count++;
- count = miscdev->osc_halt_count;
- }
-
- pr_crit("%s: OSC_HALT interrupt has triggered, 32 kHz XTAL oscillator"
- " has halted (%llu)!\n", __func__, count);
-
- return IRQ_HANDLED;
-}
-
-#if defined(CONFIG_DEBUG_FS)
-
-static int osc_halt_count_get(void *data, u64 *val)
-{
- struct pm8058_misc_device *miscdev = data;
-
- if (miscdev == NULL) {
- pr_err("%s: null pointer input.\n", __func__);
- return -EINVAL;
- }
-
- *val = miscdev->osc_halt_count;
-
- return 0;
-}
-
-DEFINE_SIMPLE_ATTRIBUTE(dbg_osc_halt_fops, osc_halt_count_get, NULL, "%llu\n");
-
-static int __devinit pmic8058_misc_dbg_probe(struct pm8058_misc_device *miscdev)
-{
- struct dentry *dent;
- struct dentry *temp;
-
- if (miscdev == NULL) {
- pr_err("%s: no parent data passed in.\n", __func__);
- return -EINVAL;
- }
-
- dent = debugfs_create_dir("pm8058-misc", NULL);
- if (dent == NULL || IS_ERR(dent)) {
- pr_err("%s: ERR debugfs_create_dir: dent=0x%X\n",
- __func__, (unsigned)dent);
- return -ENOMEM;
- }
-
- temp = debugfs_create_file("osc_halt_count", S_IRUSR, dent,
- miscdev, &dbg_osc_halt_fops);
- if (temp == NULL || IS_ERR(temp)) {
- pr_err("%s: ERR debugfs_create_file: dent=0x%X\n",
- __func__, (unsigned)temp);
- goto debug_error;
- }
-
- miscdev->dgb_dir = dent;
- return 0;
-
-debug_error:
- debugfs_remove_recursive(dent);
- return -ENOMEM;
-}
-
-static int __devexit pmic8058_misc_dbg_remove(
- struct pm8058_misc_device *miscdev)
-{
- if (miscdev->dgb_dir)
- debugfs_remove_recursive(miscdev->dgb_dir);
-
- return 0;
-}
-
-#else
-
-static int __devinit pmic8058_misc_dbg_probe(struct pm8058_misc_device *miscdev)
-{
- return 0;
-}
-
-static int __devexit pmic8058_misc_dbg_remove(
- struct pm8058_misc_device *miscdev)
-{
- return 0;
-}
-
-#endif
-
-
-static int __devinit pmic8058_misc_probe(struct platform_device *pdev)
-{
- struct pm8058_misc_device *miscdev;
- struct pm8058_chip *pm_chip;
- unsigned int irq;
- int rc;
-
- pm_chip = dev_get_drvdata(pdev->dev.parent);
- if (pm_chip == NULL) {
- pr_err("%s: no driver data passed in.\n", __func__);
- return -EFAULT;
- }
-
- irq = platform_get_irq(pdev, PM8058_MISC_IRQ_OSC_HALT);
- if (!irq) {
- pr_err("%s: no IRQ passed in.\n", __func__);
- return -EFAULT;
- }
-
- miscdev = kzalloc(sizeof *miscdev, GFP_KERNEL);
- if (miscdev == NULL) {
- pr_err("%s: kzalloc() failed.\n", __func__);
- return -ENOMEM;
- }
-
- miscdev->pm_chip = pm_chip;
- platform_set_drvdata(pdev, miscdev);
-
- rc = request_threaded_irq(irq, NULL, pm8058_osc_halt_isr,
- IRQF_TRIGGER_RISING | IRQF_DISABLED,
- "pm8058-osc_halt-irq", miscdev);
- if (rc < 0) {
- pr_err("%s: request_irq(%d) FAIL: %d\n", __func__, irq, rc);
- platform_set_drvdata(pdev, miscdev->pm_chip);
- kfree(miscdev);
- return rc;
- }
- miscdev->osc_halt_irq = irq;
- miscdev->osc_halt_count = 0;
-
- rc = pmic8058_misc_dbg_probe(miscdev);
- if (rc)
- return rc;
-
- misc_dev = miscdev;
-
- pr_notice("%s: OK\n", __func__);
- return 0;
-}
-
-static int __devexit pmic8058_misc_remove(struct platform_device *pdev)
-{
- struct pm8058_misc_device *miscdev = platform_get_drvdata(pdev);
-
- pmic8058_misc_dbg_remove(miscdev);
-
- platform_set_drvdata(pdev, miscdev->pm_chip);
- free_irq(miscdev->osc_halt_irq, miscdev);
- kfree(miscdev);
-
- return 0;
-}
-
-static struct platform_driver pmic8058_misc_driver = {
- .probe = pmic8058_misc_probe,
- .remove = __devexit_p(pmic8058_misc_remove),
- .driver = {
- .name = "pm8058-misc",
- .owner = THIS_MODULE,
- },
-};
-
-static int __init pm8058_misc_init(void)
-{
- return platform_driver_register(&pmic8058_misc_driver);
-}
-
-static void __exit pm8058_misc_exit(void)
-{
- platform_driver_unregister(&pmic8058_misc_driver);
-}
-
-module_init(pm8058_misc_init);
-module_exit(pm8058_misc_exit);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("PMIC8058 Misc Device driver");
-MODULE_VERSION("1.0");
-MODULE_ALIAS("platform:pmic8058-misc");
diff --git a/drivers/misc/pmic8058-vibrator.c b/drivers/misc/pmic8058-vibrator.c
deleted file mode 100644
index f6284ee..0000000
--- a/drivers/misc/pmic8058-vibrator.c
+++ /dev/null
@@ -1,312 +0,0 @@
-/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <linux/pmic8058-vibrator.h>
-#include <linux/mfd/pmic8058.h>
-#include <linux/pm.h>
-#include <linux/pm_runtime.h>
-#include <linux/slab.h>
-
-#include "../staging/android/timed_output.h"
-
-#define VIB_DRV 0x4A
-
-#define VIB_DRV_SEL_MASK 0xf8
-#define VIB_DRV_SEL_SHIFT 0x03
-#define VIB_DRV_EN_MANUAL_MASK 0xfc
-
-#define VIB_MAX_LEVEL_mV 3100
-#define VIB_MIN_LEVEL_mV 1200
-
-struct pmic8058_vib {
- struct hrtimer vib_timer;
- struct timed_output_dev timed_dev;
- spinlock_t lock;
- struct work_struct work;
-
- struct device *dev;
- struct pmic8058_vibrator_pdata *pdata;
- int state;
- int level;
- u8 reg_vib_drv;
-
- struct pm8058_chip *pm_chip;
-};
-
-/* REVISIT: just for debugging, will be removed in final working version */
-static void __dump_vib_regs(struct pmic8058_vib *vib, char *msg)
-{
- u8 temp;
-
- dev_dbg(vib->dev, "%s\n", msg);
-
- pm8058_read(vib->pm_chip, VIB_DRV, &temp, 1);
- dev_dbg(vib->dev, "VIB_DRV - %X\n", temp);
-}
-
-static int pmic8058_vib_read_u8(struct pmic8058_vib *vib,
- u8 *data, u16 reg)
-{
- int rc;
-
- rc = pm8058_read(vib->pm_chip, reg, data, 1);
- if (rc < 0)
- dev_warn(vib->dev, "Error reading pmic8058: %X - ret %X\n",
- reg, rc);
-
- return rc;
-}
-
-static int pmic8058_vib_write_u8(struct pmic8058_vib *vib,
- u8 data, u16 reg)
-{
- int rc;
-
- rc = pm8058_write(vib->pm_chip, reg, &data, 1);
- if (rc < 0)
- dev_warn(vib->dev, "Error writing pmic8058: %X - ret %X\n",
- reg, rc);
- return rc;
-}
-
-static int pmic8058_vib_set(struct pmic8058_vib *vib, int on)
-{
- int rc;
- u8 val;
-
- if (on) {
- rc = pm_runtime_resume(vib->dev);
- if (rc < 0)
- dev_dbg(vib->dev, "pm_runtime_resume failed\n");
-
- val = vib->reg_vib_drv;
- val |= ((vib->level << VIB_DRV_SEL_SHIFT) & VIB_DRV_SEL_MASK);
- rc = pmic8058_vib_write_u8(vib, val, VIB_DRV);
- if (rc < 0)
- return rc;
- vib->reg_vib_drv = val;
- } else {
- val = vib->reg_vib_drv;
- val &= ~VIB_DRV_SEL_MASK;
- rc = pmic8058_vib_write_u8(vib, val, VIB_DRV);
- if (rc < 0)
- return rc;
- vib->reg_vib_drv = val;
-
- rc = pm_runtime_suspend(vib->dev);
- if (rc < 0)
- dev_dbg(vib->dev, "pm_runtime_suspend failed\n");
- }
- __dump_vib_regs(vib, "vib_set_end");
-
- return rc;
-}
-
-static void pmic8058_vib_enable(struct timed_output_dev *dev, int value)
-{
- struct pmic8058_vib *vib = container_of(dev, struct pmic8058_vib,
- timed_dev);
- unsigned long flags;
-
-retry:
- spin_lock_irqsave(&vib->lock, flags);
- if (hrtimer_try_to_cancel(&vib->vib_timer) < 0) {
- spin_unlock_irqrestore(&vib->lock, flags);
- cpu_relax();
- goto retry;
- }
-
- if (value == 0)
- vib->state = 0;
- else {
- value = (value > vib->pdata->max_timeout_ms ?
- vib->pdata->max_timeout_ms : value);
- vib->state = 1;
- hrtimer_start(&vib->vib_timer,
- ktime_set(value / 1000, (value % 1000) * 1000000),
- HRTIMER_MODE_REL);
- }
- spin_unlock_irqrestore(&vib->lock, flags);
- schedule_work(&vib->work);
-}
-
-static void pmic8058_vib_update(struct work_struct *work)
-{
- struct pmic8058_vib *vib = container_of(work, struct pmic8058_vib,
- work);
-
- pmic8058_vib_set(vib, vib->state);
-}
-
-static int pmic8058_vib_get_time(struct timed_output_dev *dev)
-{
- struct pmic8058_vib *vib = container_of(dev, struct pmic8058_vib,
- timed_dev);
-
- if (hrtimer_active(&vib->vib_timer)) {
- ktime_t r = hrtimer_get_remaining(&vib->vib_timer);
- return (int) ktime_to_us(r);
- } else
- return 0;
-}
-
-static enum hrtimer_restart pmic8058_vib_timer_func(struct hrtimer *timer)
-{
- struct pmic8058_vib *vib = container_of(timer, struct pmic8058_vib,
- vib_timer);
- vib->state = 0;
- schedule_work(&vib->work);
- return HRTIMER_NORESTART;
-}
-
-#ifdef CONFIG_PM
-static int pmic8058_vib_suspend(struct device *dev)
-{
- struct pmic8058_vib *vib = dev_get_drvdata(dev);
-
- hrtimer_cancel(&vib->vib_timer);
- cancel_work_sync(&vib->work);
- /* turn-off vibrator */
- pmic8058_vib_set(vib, 0);
- return 0;
-}
-
-static struct dev_pm_ops pmic8058_vib_pm_ops = {
- .suspend = pmic8058_vib_suspend,
-};
-#endif
-
-static int __devinit pmic8058_vib_probe(struct platform_device *pdev)
-
-{
- struct pmic8058_vibrator_pdata *pdata = pdev->dev.platform_data;
- struct pmic8058_vib *vib;
- u8 val;
- int rc;
-
- struct pm8058_chip *pm_chip;
-
- pm_chip = dev_get_drvdata(pdev->dev.parent);
- if (pm_chip == NULL) {
- dev_err(&pdev->dev, "no parent data passed in\n");
- return -EFAULT;
- }
-
- if (!pdata)
- return -EINVAL;
-
- if (pdata->level_mV < VIB_MIN_LEVEL_mV ||
- pdata->level_mV > VIB_MAX_LEVEL_mV)
- return -EINVAL;
-
- vib = kzalloc(sizeof(*vib), GFP_KERNEL);
- if (!vib)
- return -ENOMEM;
-
- /* Enable runtime PM ops, start in ACTIVE mode */
- rc = pm_runtime_set_active(&pdev->dev);
- if (rc < 0)
- dev_dbg(&pdev->dev, "unable to set runtime pm state\n");
- pm_runtime_enable(&pdev->dev);
-
- vib->pm_chip = pm_chip;
- vib->pdata = pdata;
- vib->level = pdata->level_mV / 100;
- vib->dev = &pdev->dev;
-
- spin_lock_init(&vib->lock);
- INIT_WORK(&vib->work, pmic8058_vib_update);
-
- hrtimer_init(&vib->vib_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
- vib->vib_timer.function = pmic8058_vib_timer_func;
-
- vib->timed_dev.name = "vibrator";
- vib->timed_dev.get_time = pmic8058_vib_get_time;
- vib->timed_dev.enable = pmic8058_vib_enable;
-
- __dump_vib_regs(vib, "boot_vib_default");
-
- /* operate in manual mode */
- rc = pmic8058_vib_read_u8(vib, &val, VIB_DRV);
- if (rc < 0)
- goto err_read_vib;
- val &= ~VIB_DRV_EN_MANUAL_MASK;
- rc = pmic8058_vib_write_u8(vib, val, VIB_DRV);
- if (rc < 0)
- goto err_read_vib;
-
- vib->reg_vib_drv = val;
-
- rc = timed_output_dev_register(&vib->timed_dev);
- if (rc < 0)
- goto err_read_vib;
-
- pmic8058_vib_enable(&vib->timed_dev, pdata->initial_vibrate_ms);
-
- platform_set_drvdata(pdev, vib);
-
- pm_runtime_set_suspended(&pdev->dev);
- return 0;
-
-err_read_vib:
- pm_runtime_set_suspended(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
- kfree(vib);
- return rc;
-}
-
-static int __devexit pmic8058_vib_remove(struct platform_device *pdev)
-{
- struct pmic8058_vib *vib = platform_get_drvdata(pdev);
-
- pm_runtime_disable(&pdev->dev);
- cancel_work_sync(&vib->work);
- hrtimer_cancel(&vib->vib_timer);
- timed_output_dev_unregister(&vib->timed_dev);
- kfree(vib);
-
- return 0;
-}
-
-static struct platform_driver pmic8058_vib_driver = {
- .probe = pmic8058_vib_probe,
- .remove = __devexit_p(pmic8058_vib_remove),
- .driver = {
- .name = "pm8058-vib",
- .owner = THIS_MODULE,
-#ifdef CONFIG_PM
- .pm = &pmic8058_vib_pm_ops,
-#endif
- },
-};
-
-static int __init pmic8058_vib_init(void)
-{
- return platform_driver_register(&pmic8058_vib_driver);
-}
-module_init(pmic8058_vib_init);
-
-static void __exit pmic8058_vib_exit(void)
-{
- platform_driver_unregister(&pmic8058_vib_driver);
-}
-module_exit(pmic8058_vib_exit);
-
-MODULE_ALIAS("platform:pmic8058_vib");
-MODULE_DESCRIPTION("PMIC8058 vibrator driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/power/pm8921-bms.c b/drivers/power/pm8921-bms.c
index 5f63cd7..0af181b 100644
--- a/drivers/power/pm8921-bms.c
+++ b/drivers/power/pm8921-bms.c
@@ -1087,7 +1087,7 @@
* the device must be charging for reporting a higher soc, if not ignore
* this soc and continue reporting the last_soc
*/
- if (the_chip->start_percent != 0) {
+ if (the_chip->start_percent != -EINVAL) {
last_soc = soc;
} else {
pr_debug("soc = %d reporting last_soc = %d\n", soc, last_soc);
@@ -1097,19 +1097,6 @@
return bms_fake_battery ? BATTERY_POWER_SUPPLY_SOC : soc;
}
-#define XOADC_MAX_1P25V 1312500
-#define XOADC_MIN_1P25V 1187500
-#define XOADC_MAX_0P625V 656250
-#define XOADC_MIN_0P625V 593750
-
-#define HKADC_V_PER_BIT_MUL_FACTOR 977
-#define HKADC_V_PER_BIT_DIV_FACTOR 10
-static int calib_hkadc_convert_microvolt(unsigned int phy)
-{
- return (phy - 0x6000) *
- HKADC_V_PER_BIT_MUL_FACTOR / HKADC_V_PER_BIT_DIV_FACTOR;
-}
-
static void calib_hkadc(struct pm8921_bms_chip *chip)
{
int voltage, rc;
@@ -1120,16 +1107,11 @@
pr_err("ADC failed for 1.25volts rc = %d\n", rc);
return;
}
- voltage = calib_hkadc_convert_microvolt(result.adc_code);
+ voltage = xoadc_reading_to_microvolt(result.adc_code);
pr_debug("result 1.25v = 0x%x, voltage = %duV adc_meas = %lld\n",
result.adc_code, voltage, result.measurement);
- /* check for valid range */
- if (voltage > XOADC_MAX_1P25V)
- voltage = XOADC_MAX_1P25V;
- else if (voltage < XOADC_MIN_1P25V)
- voltage = XOADC_MIN_1P25V;
chip->xoadc_v125 = voltage;
rc = pm8xxx_adc_read(the_chip->ref625mv_channel, &result);
@@ -1137,14 +1119,9 @@
pr_err("ADC failed for 1.25volts rc = %d\n", rc);
return;
}
- voltage = calib_hkadc_convert_microvolt(result.adc_code);
+ voltage = xoadc_reading_to_microvolt(result.adc_code);
pr_debug("result 0.625V = 0x%x, voltage = %duV adc_meas = %lld\n",
result.adc_code, voltage, result.measurement);
- /* check for valid range */
- if (voltage > XOADC_MAX_0P625V)
- voltage = XOADC_MAX_0P625V;
- else if (voltage < XOADC_MIN_0P625V)
- voltage = XOADC_MIN_0P625V;
chip->xoadc_v0625 = voltage;
}
@@ -1363,8 +1340,8 @@
the_chip->end_percent,
last_charge_increase,
last_chargecycles);
- the_chip->start_percent = 0;
- the_chip->end_percent = 0;
+ the_chip->start_percent = -EINVAL;
+ the_chip->end_percent = -EINVAL;
}
EXPORT_SYMBOL_GPL(pm8921_bms_charging_end);
@@ -1848,6 +1825,8 @@
chip->v_failure = pdata->v_failure;
chip->calib_delay_ms = pdata->calib_delay_ms;
chip->max_voltage_uv = pdata->max_voltage_uv;
+ chip->start_percent = -EINVAL;
+ chip->end_percent = -EINVAL;
rc = set_battery_data(chip);
if (rc) {
pr_err("%s bad battery data %d\n", __func__, rc);
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 93feb81..67179e5 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -1133,26 +1133,6 @@
This drive can also be built as a module. If so, the module
will be called rtc-puv3.
-config RTC_PM8058
- tristate "PMIC8058 RTC support"
- default n
- depends on PMIC8058
- help
- Say Y here if you want support for the PMIC8058 RTC.
-
- To compile this driver as a module, choose M here: the
- module will be called pmic8058-rtc.
-
-config RTC_PM8058_WRITE_ENABLE
- bool "PM8058 RTC write enable"
- default n
- depends on RTC_PM8058
- help
- Say Y here if you want to support the write operation for
- PMIC8058 RTC.
-
- By default the write operation is not supported.
-
config RTC_DRV_PM8XXX
tristate "Qualcomm PMIC8XXX RTC"
depends on MFD_PM8XXX
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 9e41297..bd149ed 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -113,4 +113,3 @@
obj-$(CONFIG_RTC_DRV_WM831X) += rtc-wm831x.o
obj-$(CONFIG_RTC_DRV_WM8350) += rtc-wm8350.o
obj-$(CONFIG_RTC_DRV_X1205) += rtc-x1205.o
-obj-$(CONFIG_RTC_PM8058) += rtc-pm8058.o
diff --git a/drivers/rtc/rtc-pm8058.c b/drivers/rtc/rtc-pm8058.c
deleted file mode 100644
index 0376c64..0000000
--- a/drivers/rtc/rtc-pm8058.c
+++ /dev/null
@@ -1,603 +0,0 @@
-/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/rtc.h>
-#include <linux/mfd/pmic8058.h>
-#include <linux/pm.h>
-#include <linux/slab.h>
-#include <linux/rtc/rtc-pm8058.h>
-#include <linux/pm_runtime.h>
-
-#define PM8058_RTC_CTRL 0x1E8
- #define PM8058_RTC_ENABLE BIT(7)
- #define PM8058_RTC_ALARM_ENABLE BIT(1)
- #define PM8058_RTC_ABORT_ENABLE BIT(0)
-#define PM8058_RTC_ALARM_CTRL 0x1E9
- #define PM8058_RTC_ALARM_CLEAR BIT(0)
-#define PM8058_RTC_TEST 0x1F6
-#define PM8058_RTC_READ_BASE 0x1EE
-#define PM8058_RTC_WRITE_BASE 0x1EA
-#define PM8058_RTC_ALARM_BASE 0x1F2
-
-struct pm8058_rtc {
- struct rtc_device *rtc0;
- u8 rtc_ctrl_reg;
- int rtc_irq;
- int rtc_alarm_irq;
- struct pm8058_chip *pm_chip;
-};
-
-static int
-pm8058_rtc_read_bytes(struct pm8058_rtc *rtc_dd, u8 *rtc_val, int base)
-{
- int i, rc;
-
- /*
- * Read the 32-bit RTC/Alarm Value.
- * These values have to be read 8-bit at a time.
- */
- for (i = 0; i < 4; i++) {
- rc = pm8058_read(rtc_dd->pm_chip, base + i, &rtc_val[i], 1);
- if (rc < 0) {
- pr_err("%s: PM8058 read failed\n", __func__);
- return rc;
- }
- }
-
- return 0;
-}
-
-static int
-pm8058_rtc_write_bytes(struct pm8058_rtc *rtc_dd, u8 *rtc_val, int base)
-{
- int i, rc;
-
- /*
- * Write the 32-bit Value.
- * These values have to be written 8-bit at a time.
- */
- for (i = 0; i < 4; i++) {
- rc = pm8058_write(rtc_dd->pm_chip, base + i, &rtc_val[i], 1);
- if (rc < 0) {
- pr_err("%s: PM8058 read failed\n", __func__);
- return rc;
- }
- }
-
- return 0;
-}
-
-/*
- * Steps to write the RTC registers.
- * 1. Disable alarm if enabled.
- * 2. Write 0x00 to LSB.
- * 3. Write Byte[1], Byte[2], Byte[3] then Byte[0].
- * 4. Enable alarm if disabled earlier.
- */
-#ifdef CONFIG_RTC_PM8058_WRITE_ENABLE
-static int
-pm8058_rtc0_set_time(struct device *dev, struct rtc_time *tm)
-{
- int rc;
- unsigned long secs = 0;
- u8 value[4], reg = 0, alarm_enabled = 0, ctrl_reg = 0, i;
- struct pm8058_rtc *rtc_dd = dev_get_drvdata(dev);
-
- ctrl_reg = rtc_dd->rtc_ctrl_reg;
-
- rtc_tm_to_time(tm, &secs);
-
- value[0] = secs & 0xFF;
- value[1] = (secs >> 8) & 0xFF;
- value[2] = (secs >> 16) & 0xFF;
- value[3] = (secs >> 24) & 0xFF;
-
- pr_debug("%s: Seconds value to be written to RTC = %lu\n", __func__,
- secs);
- /* Disable alarm before updating RTC */
- if (ctrl_reg & PM8058_RTC_ALARM_ENABLE) {
- alarm_enabled = 1;
- ctrl_reg &= ~PM8058_RTC_ALARM_ENABLE;
- rc = pm8058_write(rtc_dd->pm_chip, PM8058_RTC_CTRL,
- &ctrl_reg, 1);
- if (rc < 0) {
- pr_err("%s: PM8058 write failed\n", __func__);
- return rc;
- }
- }
-
- /* Write Byte[1], Byte[2], Byte[3], Byte[0] */
- reg = 0;
- rc = pm8058_write(rtc_dd->pm_chip, PM8058_RTC_WRITE_BASE, ®, 1);
- if (rc < 0) {
- pr_err("%s: PM8058 write failed\n", __func__);
- return rc;
- }
-
- for (i = 1; i < 4; i++) {
- rc = pm8058_write(rtc_dd->pm_chip, PM8058_RTC_WRITE_BASE + i,
- &value[i], 1);
- if (rc < 0) {
- pr_err("%s:Write to RTC registers failed\n", __func__);
- return rc;
- }
- }
-
- rc = pm8058_write(rtc_dd->pm_chip, PM8058_RTC_WRITE_BASE,
- &value[0], 1);
- if (rc < 0) {
- pr_err("%s: PM8058 write failed\n", __func__);
- return rc;
- }
-
- if (alarm_enabled) {
- ctrl_reg |= PM8058_RTC_ALARM_ENABLE;
- rc = pm8058_write(rtc_dd->pm_chip, PM8058_RTC_CTRL,
- &ctrl_reg, 1);
- if (rc < 0) {
- pr_err("%s: PM8058 write failed\n", __func__);
- return rc;
- }
- }
-
- rtc_dd->rtc_ctrl_reg = ctrl_reg;
-
- return 0;
-}
-#endif
-
-static int
-pm8058_rtc0_read_time(struct device *dev, struct rtc_time *tm)
-{
- int rc;
- u8 value[4], reg;
- unsigned long secs = 0;
- struct pm8058_rtc *rtc_dd = dev_get_drvdata(dev);
-
- rc = pm8058_rtc_read_bytes(rtc_dd, value, PM8058_RTC_READ_BASE);
- if (rc < 0) {
- pr_err("%s: RTC time read failed\n", __func__);
- return rc;
- }
-
- /*
- * Read the LSB again and check if there has been a carry over.
- * If there is, redo the read operation.
- */
- rc = pm8058_read(rtc_dd->pm_chip, PM8058_RTC_READ_BASE, ®, 1);
- if (rc < 0) {
- pr_err("%s: PM8058 read failed\n", __func__);
- return rc;
- }
-
- if (unlikely(reg < value[0])) {
- rc = pm8058_rtc_read_bytes(rtc_dd, value,
- PM8058_RTC_READ_BASE);
- if (rc < 0) {
- pr_err("%s: RTC time read failed\n", __func__);
- return rc;
- }
- }
-
- secs = value[0] | (value[1] << 8) | (value[2] << 16) | (value[3] << 24);
-
- rtc_time_to_tm(secs, tm);
-
- rc = rtc_valid_tm(tm);
- if (rc < 0) {
- pr_err("%s: Invalid time read from PMIC8058\n", __func__);
- return rc;
- }
-
- pr_debug("%s: secs = %lu, h::m:s == %d::%d::%d, d/m/y = %d/%d/%d\n",
- __func__, secs, tm->tm_hour, tm->tm_min, tm->tm_sec,
- tm->tm_mday, tm->tm_mon, tm->tm_year);
-
- return 0;
-}
-
-static int
-pm8058_rtc0_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
-{
- int rc;
- u8 value[4], reg;
- struct rtc_time rtc_tm;
- unsigned long secs_alarm, secs_rtc;
- struct pm8058_rtc *rtc_dd = dev_get_drvdata(dev);
-
- reg = rtc_dd->rtc_ctrl_reg;
-
- /* Check if the alarm is valid */
- rc = rtc_valid_tm(&alarm->time);
- if (rc < 0) {
- pr_err("%s: Alarm time invalid\n", __func__);
- return -EINVAL;
- }
-
- rtc_tm_to_time(&alarm->time, &secs_alarm);
-
- /*
- * Read the current RTC time and verify if the alarm time is in the
- * past. If yes, return invalid.
- */
- rc = pm8058_rtc0_read_time(dev, &rtc_tm);
- if (rc) {
- pr_err("%s: Unable to read RTC time\n", __func__);
- return -EINVAL;
- }
- rtc_tm_to_time(&rtc_tm, &secs_rtc);
-
- if (secs_alarm < secs_rtc) {
- pr_err("%s: Trying to set alarm in the past\n", __func__);
- return -EINVAL;
- }
-
- value[0] = secs_alarm & 0xFF;
- value[1] = (secs_alarm >> 8) & 0xFF;
- value[2] = (secs_alarm >> 16) & 0xFF;
- value[3] = (secs_alarm >> 24) & 0xFF;
-
- rc = pm8058_rtc_write_bytes(rtc_dd, value, PM8058_RTC_ALARM_BASE);
- if (rc < 0) {
- pr_err("%s: Alarm could not be set\n", __func__);
- return rc;
- }
-
- reg = (alarm->enabled) ? (reg | PM8058_RTC_ALARM_ENABLE) :
- (reg & ~PM8058_RTC_ALARM_ENABLE);
-
- rc = pm8058_write(rtc_dd->pm_chip, PM8058_RTC_CTRL, ®, 1);
- if (rc < 0) {
- pr_err("%s: PM8058 write failed\n", __func__);
- return rc;
- }
-
- rtc_dd->rtc_ctrl_reg = reg;
-
- pr_debug("%s: Alarm Set for h:r:s=%d:%d:%d, d/m/y=%d/%d/%d\n",
- __func__, alarm->time.tm_hour, alarm->time.tm_min,
- alarm->time.tm_sec, alarm->time.tm_mday,
- alarm->time.tm_mon, alarm->time.tm_year);
-
- return 0;
-}
-
-static int
-pm8058_rtc0_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
-{
- int rc;
- u8 value[4], reg;
- unsigned long secs = 0;
- struct pm8058_rtc *rtc_dd = dev_get_drvdata(dev);
-
- reg = rtc_dd->rtc_ctrl_reg;
-
- alarm->enabled = !!(reg & PM8058_RTC_ALARM_ENABLE);
-
- rc = pm8058_rtc_read_bytes(rtc_dd, value,
- PM8058_RTC_ALARM_BASE);
- if (rc < 0) {
- pr_err("%s: RTC alarm time read failed\n", __func__);
- return rc;
- }
-
- secs = value[0] | (value[1] << 8) | (value[2] << 16) | (value[3] << 24);
-
- rtc_time_to_tm(secs, &alarm->time);
-
- rc = rtc_valid_tm(&alarm->time);
- if (rc < 0) {
- pr_err("%s: Invalid time read from PMIC8058\n", __func__);
- return rc;
- }
-
- pr_debug("%s: Alarm set for - h:r:s=%d:%d:%d, d/m/y=%d/%d/%d\n",
- __func__, alarm->time.tm_hour, alarm->time.tm_min,
- alarm->time.tm_sec, alarm->time.tm_mday,
- alarm->time.tm_mon, alarm->time.tm_year);
-
- return 0;
-}
-
-
-static int
-pm8058_rtc0_alarm_irq_enable(struct device *dev, unsigned int enable)
-{
- int rc;
- struct pm8058_rtc *rtc_dd = dev_get_drvdata(dev);
- u8 reg;
-
- reg = rtc_dd->rtc_ctrl_reg;
- reg = (enable) ? (reg | PM8058_RTC_ALARM_ENABLE) :
- (reg & ~PM8058_RTC_ALARM_ENABLE);
-
- rc = pm8058_write(rtc_dd->pm_chip, PM8058_RTC_CTRL, ®, 1);
- if (rc < 0) {
- pr_err("%s: PM8058 write failed\n", __func__);
- return rc;
- }
-
- rtc_dd->rtc_ctrl_reg = reg;
-
- return rc;
-}
-
-static struct rtc_class_ops pm8058_rtc0_ops = {
- .read_time = pm8058_rtc0_read_time,
- .set_alarm = pm8058_rtc0_set_alarm,
- .read_alarm = pm8058_rtc0_read_alarm,
- .alarm_irq_enable = pm8058_rtc0_alarm_irq_enable,
-};
-
-static irqreturn_t pm8058_alarm_trigger(int irq, void *dev_id)
-{
- u8 reg;
- int rc;
- unsigned long events = 0;
- struct pm8058_rtc *rtc_dd = dev_id;
-
- events = RTC_IRQF | RTC_AF;
- rtc_update_irq(rtc_dd->rtc0, 1, events);
-
- pr_debug("%s: Alarm Triggered !!\n", __func__);
-
- /* Clear the alarm enable bit */
- reg = rtc_dd->rtc_ctrl_reg;
-
- reg &= ~PM8058_RTC_ALARM_ENABLE;
- rc = pm8058_write(rtc_dd->pm_chip, PM8058_RTC_CTRL,
- ®, 1);
- if (rc < 0) {
- pr_err("%s: PM8058 write failed\n", __func__);
- goto rtc_alarm_handled;
- }
-
- rtc_dd->rtc_ctrl_reg = reg;
-
- /* Clear RTC alarm register */
- rc = pm8058_read(rtc_dd->pm_chip, PM8058_RTC_ALARM_CTRL, ®, 1);
- if (rc < 0) {
- pr_err("%s: PM8058 read failed\n", __func__);
- goto rtc_alarm_handled;
- }
-
- reg &= ~PM8058_RTC_ALARM_CLEAR;
- rc = pm8058_write(rtc_dd->pm_chip, PM8058_RTC_ALARM_CTRL, ®, 1);
- if (rc < 0) {
- pr_err("%s: PM8058 write failed\n", __func__);
- goto rtc_alarm_handled;
- }
-
-rtc_alarm_handled:
- return IRQ_HANDLED;
-}
-
-static int __devinit pm8058_rtc_probe(struct platform_device *pdev)
-{
- int rc;
- u8 reg, reg_alarm;
- struct pm8058_rtc *rtc_dd;
- struct pm8058_chip *pm_chip;
-
- pm_chip = dev_get_drvdata(pdev->dev.parent);
- if (pm_chip == NULL) {
- pr_err("%s: Invalid driver information\n", __func__);
- return -ENXIO;
- }
-
- rtc_dd = kzalloc(sizeof(*rtc_dd), GFP_KERNEL);
- if (rtc_dd == NULL) {
- pr_err("%s: Unable to allocate memory\n", __func__);
- return -ENOMEM;
- }
-
- /* Enable runtime PM ops, start in ACTIVE mode */
- rc = pm_runtime_set_active(&pdev->dev);
- if (rc < 0)
- dev_dbg(&pdev->dev, "unable to set runtime pm state\n");
- pm_runtime_enable(&pdev->dev);
-
- rtc_dd->rtc_irq = platform_get_irq(pdev, 0);
- rtc_dd->rtc_alarm_irq = platform_get_irq(pdev, 1);
- if (!rtc_dd->rtc_alarm_irq || !rtc_dd->rtc_irq) {
- pr_err("%s: RTC Alarm IRQ absent\n", __func__);
- rc = -ENXIO;
- goto fail_rtc_enable;
- }
-
- rtc_dd->pm_chip = pm_chip;
-
- rc = pm8058_read(pm_chip, PM8058_RTC_CTRL, ®, 1);
- if (rc < 0) {
- pr_err("%s: PM8058 read failed\n", __func__);
- goto fail_rtc_enable;
- }
-
- /* Enable RTC, ABORT enable and disable alarm */
- reg |= ((PM8058_RTC_ENABLE | PM8058_RTC_ABORT_ENABLE) &
- ~PM8058_RTC_ALARM_ENABLE);
-
- rc = pm8058_write(pm_chip, PM8058_RTC_CTRL, ®, 1);
- if (rc < 0) {
- pr_err("%s: PM8058 write failed\n", __func__);
- goto fail_rtc_enable;
- }
-
- /* Clear RTC alarm control register */
- rc = pm8058_read(rtc_dd->pm_chip, PM8058_RTC_ALARM_CTRL,
- ®_alarm, 1);
- if (rc < 0) {
- pr_err("%s: PM8058 read failed\n", __func__);
- goto fail_rtc_enable;
- }
-
- reg_alarm &= ~PM8058_RTC_ALARM_CLEAR;
- rc = pm8058_write(rtc_dd->pm_chip, PM8058_RTC_ALARM_CTRL,
- ®_alarm, 1);
- if (rc < 0) {
- pr_err("%s: PM8058 write failed\n", __func__);
- goto fail_rtc_enable;
- }
-
- rtc_dd->rtc_ctrl_reg = reg;
-
-#ifdef CONFIG_RTC_PM8058_WRITE_ENABLE
- pm8058_rtc0_ops.set_time = pm8058_rtc0_set_time;
-#endif
-
- platform_set_drvdata(pdev, rtc_dd);
-
- /* Register the RTC device */
- rtc_dd->rtc0 = rtc_device_register("pm8058_rtc0", &pdev->dev,
- &pm8058_rtc0_ops, THIS_MODULE);
- if (IS_ERR(rtc_dd->rtc0)) {
- pr_err("%s: RTC device registration failed (%ld)\n",
- __func__, PTR_ERR(rtc_dd->rtc0));
- rc = PTR_ERR(rtc_dd->rtc0);
- goto fail_rtc_enable;
- }
-
- /* Request the alarm IRQ */
- rc = request_threaded_irq(rtc_dd->rtc_alarm_irq, NULL,
- pm8058_alarm_trigger, IRQF_TRIGGER_RISING,
- "pm8058_rtc_alarm", rtc_dd);
- if (rc < 0) {
- pr_err("%s: Request IRQ failed (%d)\n", __func__, rc);
- goto fail_req_irq;
- }
-
- device_init_wakeup(&pdev->dev, 1);
-
- pr_debug("%s: Probe success !!\n", __func__);
-
- return 0;
-
-fail_req_irq:
- rtc_device_unregister(rtc_dd->rtc0);
-fail_rtc_enable:
- pm_runtime_set_suspended(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
- kfree(rtc_dd);
- return rc;
-}
-
-#ifdef CONFIG_PM
-static int pm8058_rtc_resume(struct device *dev)
-{
- struct pm8058_rtc *rtc_dd = dev_get_drvdata(dev);
-
- if (device_may_wakeup(dev))
- disable_irq_wake(rtc_dd->rtc_alarm_irq);
-
- return 0;
-}
-
-static int pm8058_rtc_suspend(struct device *dev)
-{
- struct pm8058_rtc *rtc_dd = dev_get_drvdata(dev);
-
- if (device_may_wakeup(dev))
- enable_irq_wake(rtc_dd->rtc_alarm_irq);
-
- return 0;
-}
-
-static struct dev_pm_ops pm8058_rtc_pm_ops = {
- .suspend = pm8058_rtc_suspend,
- .resume = pm8058_rtc_resume,
-};
-#endif
-
-static int __devexit pm8058_rtc_remove(struct platform_device *pdev)
-{
- struct pm8058_rtc *rtc_dd = platform_get_drvdata(pdev);
-
- pm_runtime_set_suspended(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
-
- device_init_wakeup(&pdev->dev, 0);
- free_irq(rtc_dd->rtc_alarm_irq, rtc_dd);
- rtc_device_unregister(rtc_dd->rtc0);
- kfree(rtc_dd);
-
- return 0;
-}
-
-static void pm8058_rtc_shutdown(struct platform_device *pdev)
-{
- u8 reg;
- int rc, i;
- bool rtc_alarm_powerup = false;
- struct pm8058_rtc *rtc_dd = platform_get_drvdata(pdev);
- struct pm8058_rtc_platform_data *pdata = pdev->dev.platform_data;
-
- if (pdata != NULL)
- rtc_alarm_powerup = pdata->rtc_alarm_powerup;
-
- if (!rtc_alarm_powerup) {
-
- dev_dbg(&pdev->dev, "Disabling alarm interrupts\n");
-
- /* Disable RTC alarms */
- reg = rtc_dd->rtc_ctrl_reg;
- reg &= ~PM8058_RTC_ALARM_ENABLE;
- rc = pm8058_write(rtc_dd->pm_chip, PM8058_RTC_CTRL, ®, 1);
- if (rc < 0) {
- pr_err("%s: PM8058 write failed\n", __func__);
- return;
- }
-
- /* Clear Alarm register */
- reg = 0x0;
- for (i = 0; i < 4; i++) {
- rc = pm8058_write(rtc_dd->pm_chip,
- PM8058_RTC_ALARM_BASE + i, ®, 1);
- if (rc < 0) {
- pr_err("%s: PM8058 write failed\n", __func__);
- return;
- }
- }
-
- }
-}
-
-static struct platform_driver pm8058_rtc_driver = {
- .probe = pm8058_rtc_probe,
- .remove = __devexit_p(pm8058_rtc_remove),
- .shutdown = pm8058_rtc_shutdown,
- .driver = {
- .name = "pm8058-rtc",
- .owner = THIS_MODULE,
-#ifdef CONFIG_PM
- .pm = &pm8058_rtc_pm_ops,
-#endif
- },
-};
-
-static int __init pm8058_rtc_init(void)
-{
- return platform_driver_register(&pm8058_rtc_driver);
-}
-
-static void __exit pm8058_rtc_exit(void)
-{
- platform_driver_unregister(&pm8058_rtc_driver);
-}
-
-module_init(pm8058_rtc_init);
-module_exit(pm8058_rtc_exit);
-
-MODULE_ALIAS("platform:pm8058-rtc");
-MODULE_DESCRIPTION("PMIC8058 RTC driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index c44c245..794775a 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -23,31 +23,6 @@
Say Y if your user-space is new enough.
-config THERMAL_PM8901
- tristate "Qualcomm PM8901 Temperature Alarm"
- depends on PMIC8901
- depends on THERMAL
- default n
- help
- This enables a thermal Sysfs driver for the PMIC 8901 device. It
- shows up in Sysfs as a thermal zone with multiple trip points.
- Enabling the thermal zone device via the mode file results in
- shifting over temperature shutdown control of the PMIC from hardware
- to software.
-
-config THERMAL_PM8058
- tristate "Qualcomm PM8058 Temperature Alarm"
- depends on PMIC8058
- depends on THERMAL
- depends on SENSORS_MSM_ADC
- default n
- help
- This enables a thermal Sysfs driver for the PMIC 8058 device. It
- shows up in Sysfs as a thermal zone with multiple trip points.
- Enabling the thermal zone device via the mode file results in
- shifting over temperature shutdown control of the PMIC from hardware
- to software.
-
config THERMAL_MSM_POPMEM
tristate "Qualcomm MSM POP memory temperature sensor"
depends on THERMAL
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index c5d792c..31b5c3f 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -3,8 +3,6 @@
#
obj-$(CONFIG_THERMAL) += thermal_sys.o
-obj-$(CONFIG_THERMAL_PM8901) += pmic8901-tm.o
-obj-$(CONFIG_THERMAL_PM8058) += pmic8058-tm.o
obj-$(CONFIG_THERMAL_MSM_POPMEM) += msm_popmem-tm.o
obj-$(CONFIG_THERMAL_TSENS) += msm_tsens.o
obj-$(CONFIG_THERMAL_TSENS8960) += msm8960_tsens.o
diff --git a/drivers/thermal/pmic8058-tm.c b/drivers/thermal/pmic8058-tm.c
deleted file mode 100644
index 2589494..0000000
--- a/drivers/thermal/pmic8058-tm.c
+++ /dev/null
@@ -1,504 +0,0 @@
-/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * 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.
- *
- */
-/*
- * Qualcomm PMIC8058 Thermal Manager driver
- *
- */
-
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <linux/platform_device.h>
-#include <linux/err.h>
-#include <linux/thermal.h>
-#include <linux/interrupt.h>
-#include <linux/mfd/pmic8058.h>
-#include <linux/completion.h>
-
-#include <linux/msm_adc.h>
-
-/* PMIC8058 TEMP_ALRM registers */
-#define SSBI_REG_TEMP_ALRM_CTRL 0x1B
-#define SSBI_REG_TEMP_ALRM_PWM 0x9B
-#define SSBI_REG_TEMP_ALRM_TEST1 0x7A
-#define SSBI_REG_TEMP_ALRM_TEST2 0xAB
-
-/* TEMP_ALRM_CTRL */
-#define PM8058_TEMP_ST3_SD 0x80
-#define PM8058_TEMP_ST2_SD 0x40
-#define PM8058_TEMP_STATUS_MASK 0x30
-#define PM8058_TEMP_STATUS_SHIFT 4
-#define PM8058_TEMP_THRESH_MASK 0x0C
-#define PM8058_TEMP_THRESH_SHIFT 2
-#define PM8058_TEMP_OVRD_ST3 0x02
-#define PM8058_TEMP_OVRD_ST2 0x01
-#define PM8058_TEMP_OVRD_MASK 0x03
-
-#define PM8058_TEMP_STAGE_STEP 20000 /* Stage step: 20 C */
-#define PM8058_TEMP_STAGE_HYSTERESIS 2000
-
-#define PM8058_TEMP_THRESH_MIN 105000 /* Threshold Min: 105 C */
-#define PM8058_TEMP_THRESH_STEP 5000 /* Threshold step: 5 C */
-
-/* TEMP_ALRM_PWM */
-#define PM8058_TEMP_PWM_EN_MASK 0xC0
-#define PM8058_TEMP_PWM_EN_SHIFT 6
-#define PM8058_TEMP_PWM_PER_PRE_MASK 0x38
-#define PM8058_TEMP_PWM_PER_PRE_SHIFT 3
-#define PM8058_TEMP_PWM_PER_DIV_MASK 0x07
-#define PM8058_TEMP_PWM_PER_DIV_SHIFT 0
-
-/* Trips: from critical to less critical */
-#define PM8058_TRIP_STAGE3 0
-#define PM8058_TRIP_STAGE2 1
-#define PM8058_TRIP_STAGE1 2
-#define PM8058_TRIP_NUM 3
-
-#define PM8058_TEMP_ADC_CH CHANNEL_ADC_DIE_TEMP
-
-struct pm8058_tm_device {
- struct pm8058_chip *pm_chip;
- struct thermal_zone_device *tz_dev;
- unsigned long temp;
- enum thermal_device_mode mode;
- unsigned int thresh;
- unsigned int stage;
- unsigned int irq;
- void *adc_handle;
-};
-
-enum pmic_thermal_override_mode {
- SOFTWARE_OVERRIDE_DISABLED = 0,
- SOFTWARE_OVERRIDE_ENABLED,
-};
-
-static inline int pm8058_tm_read_ctrl(struct pm8058_chip *chip, u8 *reg)
-{
- int rc;
-
- rc = pm8058_read(chip, SSBI_REG_TEMP_ALRM_CTRL, reg, 1);
- if (rc)
- pr_err("%s: pm8058_read FAIL: rc=%d\n", __func__, rc);
-
- return rc;
-}
-
-static inline int pm8058_tm_write_ctrl(struct pm8058_chip *chip, u8 reg)
-{
- int rc;
-
- rc = pm8058_write(chip, SSBI_REG_TEMP_ALRM_CTRL, ®, 1);
- if (rc)
- pr_err("%s: pm8058_write FAIL: rc=%d\n", __func__, rc);
-
- return rc;
-}
-
-static inline int pm8058_tm_write_pwm(struct pm8058_chip *chip, u8 reg)
-{
- int rc;
-
- rc = pm8058_write(chip, SSBI_REG_TEMP_ALRM_PWM, ®, 1);
- if (rc)
- pr_err("%s: pm8058_write FAIL: rc=%d\n", __func__, rc);
-
- return rc;
-}
-
-static inline int
-pm8058_tm_shutdown_override(struct pm8058_chip *chip,
- enum pmic_thermal_override_mode mode)
-{
- int rc;
- u8 reg;
-
- rc = pm8058_tm_read_ctrl(chip, ®);
- if (rc < 0)
- return rc;
-
- reg &= ~(PM8058_TEMP_OVRD_MASK | PM8058_TEMP_STATUS_MASK);
- if (mode == SOFTWARE_OVERRIDE_ENABLED)
- reg |= (PM8058_TEMP_OVRD_ST3 | PM8058_TEMP_OVRD_ST2) &
- PM8058_TEMP_OVRD_MASK;
-
- rc = pm8058_tm_write_ctrl(chip, reg);
-
- return rc;
-}
-
-static int pm8058_tz_get_temp(struct thermal_zone_device *thermal,
- unsigned long *temp)
-{
- struct pm8058_tm_device *tm = thermal->devdata;
- DECLARE_COMPLETION_ONSTACK(wait);
- struct adc_chan_result adc_result = {
- .physical = 0lu,
- };
- int rc;
-
- if (!tm || !temp)
- return -EINVAL;
-
- *temp = tm->temp;
-
- rc = adc_channel_request_conv(tm->adc_handle, &wait);
- if (rc < 0) {
- pr_err("%s: adc_channel_request_conv() failed, rc = %d\n",
- __func__, rc);
- return rc;
- }
-
- wait_for_completion(&wait);
-
- rc = adc_channel_read_result(tm->adc_handle, &adc_result);
- if (rc < 0) {
- pr_err("%s: adc_channel_read_result() failed, rc = %d\n",
- __func__, rc);
- return rc;
- }
-
- *temp = adc_result.physical;
- tm->temp = adc_result.physical;
-
- return 0;
-}
-
-static int pm8058_tz_get_mode(struct thermal_zone_device *thermal,
- enum thermal_device_mode *mode)
-{
- struct pm8058_tm_device *tm = thermal->devdata;
-
- if (!tm || !mode)
- return -EINVAL;
-
- *mode = tm->mode;
-
- return 0;
-}
-
-static int pm8058_tz_set_mode(struct thermal_zone_device *thermal,
- enum thermal_device_mode mode)
-{
- struct pm8058_tm_device *tm = thermal->devdata;
-
- if (!tm)
- return -EINVAL;
-
- if (mode != tm->mode) {
- if (mode == THERMAL_DEVICE_ENABLED)
- pm8058_tm_shutdown_override(tm->pm_chip,
- SOFTWARE_OVERRIDE_ENABLED);
- else
- pm8058_tm_shutdown_override(tm->pm_chip,
- SOFTWARE_OVERRIDE_DISABLED);
- }
- tm->mode = mode;
-
- return 0;
-}
-
-static int pm8058_tz_get_trip_type(struct thermal_zone_device *thermal,
- int trip, enum thermal_trip_type *type)
-{
- struct pm8058_tm_device *tm = thermal->devdata;
-
- if (!tm || trip < 0 || !type)
- return -EINVAL;
-
- switch (trip) {
- case PM8058_TRIP_STAGE3:
- *type = THERMAL_TRIP_CRITICAL;
- break;
- case PM8058_TRIP_STAGE2:
- *type = THERMAL_TRIP_HOT;
- break;
- case PM8058_TRIP_STAGE1:
- *type = THERMAL_TRIP_HOT;
- break;
- default:
- return -EINVAL;
- }
-
- return 0;
-}
-
-static int pm8058_tz_get_trip_temp(struct thermal_zone_device *thermal,
- int trip, unsigned long *temp)
-{
- struct pm8058_tm_device *tm = thermal->devdata;
- int thresh_temp;
-
- if (!tm || trip < 0 || !temp)
- return -EINVAL;
-
- thresh_temp = tm->thresh * PM8058_TEMP_THRESH_STEP +
- PM8058_TEMP_THRESH_MIN;
-
- switch (trip) {
- case PM8058_TRIP_STAGE3:
- thresh_temp += 2 * PM8058_TEMP_STAGE_STEP;
- break;
- case PM8058_TRIP_STAGE2:
- thresh_temp += PM8058_TEMP_STAGE_STEP;
- break;
- case PM8058_TRIP_STAGE1:
- break;
- default:
- return -EINVAL;
- }
-
- *temp = thresh_temp;
-
- return 0;
-}
-
-static int pm8058_tz_get_crit_temp(struct thermal_zone_device *thermal,
- unsigned long *temp)
-{
- struct pm8058_tm_device *tm = thermal->devdata;
-
- if (!tm || !temp)
- return -EINVAL;
-
- *temp = tm->thresh * PM8058_TEMP_THRESH_STEP + PM8058_TEMP_THRESH_MIN +
- 2 * PM8058_TEMP_STAGE_STEP;
-
- return 0;
-}
-
-static struct thermal_zone_device_ops pm8058_thermal_zone_ops = {
- .get_temp = pm8058_tz_get_temp,
- .get_mode = pm8058_tz_get_mode,
- .set_mode = pm8058_tz_set_mode,
- .get_trip_type = pm8058_tz_get_trip_type,
- .get_trip_temp = pm8058_tz_get_trip_temp,
- .get_crit_temp = pm8058_tz_get_crit_temp,
-};
-
-static irqreturn_t pm8058_tm_isr(int irq, void *data)
-{
- struct pm8058_tm_device *tm = data;
- int rc;
- u8 reg;
-
- rc = pm8058_tm_read_ctrl(tm->pm_chip, ®);
- if (rc < 0)
- goto isr_handled;
-
- tm->stage = (reg & PM8058_TEMP_STATUS_MASK) >> PM8058_TEMP_STATUS_SHIFT;
- tm->thresh = (reg & PM8058_TEMP_THRESH_MASK) >>
- PM8058_TEMP_THRESH_SHIFT;
-
- if (reg & (PM8058_TEMP_ST2_SD | PM8058_TEMP_ST3_SD)) {
- reg &= ~(PM8058_TEMP_ST2_SD | PM8058_TEMP_ST3_SD |
- PM8058_TEMP_STATUS_MASK);
- pm8058_tm_write_ctrl(tm->pm_chip, reg);
- }
-
- thermal_zone_device_update(tm->tz_dev);
-
- /* Notify user space */
- if (tm->mode == THERMAL_DEVICE_ENABLED)
- kobject_uevent(&tm->tz_dev->device.kobj, KOBJ_CHANGE);
-
-isr_handled:
- return IRQ_HANDLED;
-}
-
-static int pm8058_tm_init_reg(struct pm8058_tm_device *tm)
-{
- int rc;
- u8 reg;
-
- rc = pm8058_tm_read_ctrl(tm->pm_chip, ®);
- if (rc < 0)
- return rc;
-
- tm->stage = (reg & PM8058_TEMP_STATUS_MASK) >> PM8058_TEMP_STATUS_SHIFT;
- tm->temp = 0;
-
- /* Use temperature threshold set 0: (105, 125, 145) */
- tm->thresh = 0;
- reg = (tm->thresh << PM8058_TEMP_THRESH_SHIFT) &
- PM8058_TEMP_THRESH_MASK;
- rc = pm8058_tm_write_ctrl(tm->pm_chip, reg);
- if (rc < 0)
- return rc;
-
- /*
- * Set the PMIC alarm module PWM to have a frequency of 8 Hz. This
- * helps cut down on the number of unnecessary interrupts fired when
- * changing between thermal stages. Also, Enable the over temperature
- * PWM whenever the PMIC is enabled.
- */
- reg = 1 << PM8058_TEMP_PWM_EN_SHIFT |
- 3 << PM8058_TEMP_PWM_PER_PRE_SHIFT |
- 3 << PM8058_TEMP_PWM_PER_DIV_SHIFT;
-
- rc = pm8058_tm_write_pwm(tm->pm_chip, reg);
-
- return rc;
-}
-
-static int __devinit pmic8058_tm_probe(struct platform_device *pdev)
-{
- struct pm8058_tm_device *tmdev;
- struct pm8058_chip *pm_chip;
- unsigned int irq;
- int rc;
-
- pm_chip = dev_get_drvdata(pdev->dev.parent);
- if (pm_chip == NULL) {
- pr_err("%s: no driver data passed in.\n", __func__);
- return -EFAULT;
- }
-
- irq = platform_get_irq(pdev, 0);
- if (!irq) {
- pr_err("%s: no IRQ passed in.\n", __func__);
- return -EFAULT;
- }
-
- tmdev = kzalloc(sizeof *tmdev, GFP_KERNEL);
- if (tmdev == NULL) {
- pr_err("%s: kzalloc() failed.\n", __func__);
- return -ENOMEM;
- }
-
- rc = adc_channel_open(PM8058_TEMP_ADC_CH, &(tmdev->adc_handle));
- if (rc < 0) {
- pr_err("%s: adc_channel_open() failed.\n", __func__);
- kfree(tmdev);
- return rc;
- }
-
- tmdev->pm_chip = pm_chip;
- tmdev->tz_dev = thermal_zone_device_register("pm8058_tz",
- PM8058_TRIP_NUM, tmdev,
- &pm8058_thermal_zone_ops,
- 0, 0, 0, 0);
- if (tmdev->tz_dev == NULL) {
- pr_err("%s: thermal_zone_device_register() failed.\n",
- __func__);
- adc_channel_close(tmdev->adc_handle);
- kfree(tmdev);
- return -ENODEV;
- }
-
- rc = pm8058_tm_init_reg(tmdev);
- pm8058_tm_shutdown_override(tmdev->pm_chip, SOFTWARE_OVERRIDE_DISABLED);
- if (rc < 0) {
- thermal_zone_device_unregister(tmdev->tz_dev);
- adc_channel_close(tmdev->adc_handle);
- kfree(tmdev);
- return rc;
- }
-
- /* start in HW control, switch to SW control when user changes mode */
- tmdev->mode = THERMAL_DEVICE_DISABLED;
- thermal_zone_device_update(tmdev->tz_dev);
-
- platform_set_drvdata(pdev, tmdev);
-
- rc = request_threaded_irq(irq, NULL, pm8058_tm_isr,
- IRQF_TRIGGER_RISING | IRQF_DISABLED,
- "pm8058-tm-irq", tmdev);
- if (rc < 0) {
- pr_err("%s: request_irq(%d) FAIL: %d\n", __func__, irq, rc);
- thermal_zone_device_unregister(tmdev->tz_dev);
- platform_set_drvdata(pdev, tmdev->pm_chip);
- adc_channel_close(tmdev->adc_handle);
- kfree(tmdev);
- return rc;
- }
- tmdev->irq = irq;
-
- pr_notice("%s: OK\n", __func__);
- return 0;
-}
-
-static int __devexit pmic8058_tm_remove(struct platform_device *pdev)
-{
- struct pm8058_tm_device *tmdev = platform_get_drvdata(pdev);
-
- thermal_zone_device_unregister(tmdev->tz_dev);
- platform_set_drvdata(pdev, tmdev->pm_chip);
- pm8058_tm_shutdown_override(tmdev->pm_chip, THERMAL_DEVICE_DISABLED);
- adc_channel_close(tmdev->adc_handle);
- free_irq(tmdev->irq, tmdev);
- kfree(tmdev);
-
- return 0;
-}
-
-#ifdef CONFIG_PM
-static int pmic8058_tm_suspend(struct device *dev)
-{
- struct platform_device *pdev = to_platform_device(dev);
- struct pm8058_tm_device *tm = platform_get_drvdata(pdev);
-
- /* Clear override bits in suspend to allow hardware control */
- pm8058_tm_shutdown_override(tm->pm_chip, SOFTWARE_OVERRIDE_DISABLED);
-
- return 0;
-}
-
-static int pmic8058_tm_resume(struct device *dev)
-{
- struct platform_device *pdev = to_platform_device(dev);
- struct pm8058_tm_device *tm = platform_get_drvdata(pdev);
-
- /* Override hardware actions so software can control */
- if (tm->mode == THERMAL_DEVICE_ENABLED)
- pm8058_tm_shutdown_override(tm->pm_chip,
- SOFTWARE_OVERRIDE_ENABLED);
-
- return 0;
-}
-
-static const struct dev_pm_ops pmic8058_tm_pm_ops = {
- .suspend = pmic8058_tm_suspend,
- .resume = pmic8058_tm_resume,
-};
-
-#define PM8058_TM_PM_OPS (&pmic8058_tm_pm_ops)
-#else
-#define PM8058_TM_PM_OPS NULL
-#endif
-
-static struct platform_driver pmic8058_tm_driver = {
- .probe = pmic8058_tm_probe,
- .remove = __devexit_p(pmic8058_tm_remove),
- .driver = {
- .name = "pm8058-tm",
- .owner = THIS_MODULE,
- .pm = PM8058_TM_PM_OPS,
- },
-};
-
-static int __init pm8058_tm_init(void)
-{
- return platform_driver_register(&pmic8058_tm_driver);
-}
-
-static void __exit pm8058_tm_exit(void)
-{
- platform_driver_unregister(&pmic8058_tm_driver);
-}
-
-module_init(pm8058_tm_init);
-module_exit(pm8058_tm_exit);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("PMIC8058 Thermal Manager driver");
-MODULE_VERSION("1.0");
-MODULE_ALIAS("platform:pmic8058-tm");
diff --git a/drivers/thermal/pmic8901-tm.c b/drivers/thermal/pmic8901-tm.c
deleted file mode 100644
index 0ff5788..0000000
--- a/drivers/thermal/pmic8901-tm.c
+++ /dev/null
@@ -1,594 +0,0 @@
-/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * 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.
- *
- */
-/*
- * Qualcomm PMIC8901 Thermal Manager driver
- *
- */
-
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/err.h>
-#include <linux/thermal.h>
-#include <linux/interrupt.h>
-#include <linux/slab.h>
-#include <linux/mfd/pmic8901.h>
-
-/* PMIC8901 TEMP_ALRM registers */
-#define SSBI_REG_TEMP_ALRM_CTRL 0x23
-#define SSBI_REG_TEMP_ALRM_PWM 0x24
-
-/* TEMP_ALRM_CTRL */
-#define PM8901_TEMP_ST3_SD 0x80
-#define PM8901_TEMP_ST2_SD 0x40
-#define PM8901_TEMP_STATUS_MASK 0x30
-#define PM8901_TEMP_STATUS_SHIFT 4
-#define PM8901_TEMP_THRESH_MASK 0x0C
-#define PM8901_TEMP_THRESH_SHIFT 2
-#define PM8901_TEMP_OVRD_ST3 0x02
-#define PM8901_TEMP_OVRD_ST2 0x01
-#define PM8901_TEMP_OVRD_MASK 0x03
-
-#define PM8901_TEMP_STAGE_STEP 20000 /* Stage step: 20 C */
-#define PM8901_TEMP_STAGE_HYSTERESIS 2000
-
-#define PM8901_TEMP_THRESH_MIN 105000 /* Threshold Min: 105 C */
-#define PM8901_TEMP_THRESH_STEP 5000 /* Threshold step: 5 C */
-
-/* TEMP_ALRM_PWM */
-#define PM8901_TEMP_PWM_EN_MASK 0xC0
-#define PM8901_TEMP_PWM_EN_SHIFT 6
-#define PM8901_TEMP_PWM_PER_PRE_MASK 0x38
-#define PM8901_TEMP_PWM_PER_PRE_SHIFT 3
-#define PM8901_TEMP_PWM_PER_DIV_MASK 0x07
-#define PM8901_TEMP_PWM_PER_DIV_SHIFT 0
-
-/* Trips: from critical to less critical */
-#define PM8901_TRIP_STAGE3 0
-#define PM8901_TRIP_STAGE2 1
-#define PM8901_TRIP_STAGE1 2
-#define PM8901_TRIP_NUM 3
-
-/* Used because there is no means to read the die temperature */
-#define DEFAULT_NO_ADC_TEMP 37000
-
-struct pm8901_tm_device {
- struct pm8901_chip *pm_chip;
- struct thermal_zone_device *tz_dev;
- unsigned long temp;
- enum thermal_device_mode mode;
- unsigned int thresh;
- unsigned int stage;
- unsigned int irq;
- unsigned int hi_irq;
-};
-
-enum pmic_thermal_override_mode {
- SOFTWARE_OVERRIDE_DISABLED = 0,
- SOFTWARE_OVERRIDE_ENABLED,
-};
-
-static inline int pm8901_tm_read_ctrl(struct pm8901_chip *chip, u8 *reg)
-{
- int rc;
-
- rc = pm8901_read(chip, SSBI_REG_TEMP_ALRM_CTRL, reg, 1);
- if (rc)
- pr_err("%s: pm8901_read FAIL: rc=%d\n", __func__, rc);
-
- return rc;
-}
-
-static inline int pm8901_tm_write_ctrl(struct pm8901_chip *chip, u8 reg)
-{
- int rc;
-
- rc = pm8901_write(chip, SSBI_REG_TEMP_ALRM_CTRL, ®, 1);
- if (rc)
- pr_err("%s: pm8901_write FAIL: rc=%d\n", __func__, rc);
-
- return rc;
-}
-
-static inline int pm8901_tm_read_pwm(struct pm8901_chip *chip, u8 *reg)
-{
- int rc;
-
- rc = pm8901_read(chip, SSBI_REG_TEMP_ALRM_PWM, reg, 1);
- if (rc)
- pr_err("%s: pm8901_read FAIL: rc=%d\n", __func__, rc);
-
- return rc;
-}
-
-static inline int pm8901_tm_write_pwm(struct pm8901_chip *chip, u8 reg)
-{
- int rc;
-
- rc = pm8901_write(chip, SSBI_REG_TEMP_ALRM_PWM, ®, 1);
- if (rc)
- pr_err("%s: pm8901_write FAIL: rc=%d\n", __func__, rc);
-
- return rc;
-}
-
-static inline int
-pm8901_tm_shutdown_override(struct pm8901_chip *chip,
- enum pmic_thermal_override_mode mode)
-{
- int rc;
- u8 reg;
-
- rc = pm8901_tm_read_ctrl(chip, ®);
- if (rc < 0)
- return rc;
-
- reg &= ~(PM8901_TEMP_OVRD_MASK | PM8901_TEMP_STATUS_MASK);
- if (mode == SOFTWARE_OVERRIDE_ENABLED)
- reg |= (PM8901_TEMP_OVRD_ST3 | PM8901_TEMP_OVRD_ST2) &
- PM8901_TEMP_OVRD_MASK;
-
- rc = pm8901_tm_write_ctrl(chip, reg);
-
- return rc;
-}
-
-/*
- * This function initializes the internal temperature value based on only the
- * current thermal stage and threshold.
- */
-static int pm8901_tm_init_temp(struct pm8901_tm_device *tm)
-{
- int rc;
- u8 reg;
-
- rc = pm8901_tm_read_ctrl(tm->pm_chip, ®);
- if (rc < 0)
- return rc;
-
- tm->stage = (reg & PM8901_TEMP_STATUS_MASK) >> PM8901_TEMP_STATUS_SHIFT;
- tm->thresh = (reg & PM8901_TEMP_THRESH_MASK) >>
- PM8901_TEMP_THRESH_SHIFT;
-
- if (tm->stage) {
- tm->temp = tm->thresh * PM8901_TEMP_THRESH_STEP +
- (tm->stage - 1) * PM8901_TEMP_STAGE_STEP +
- PM8901_TEMP_THRESH_MIN;
- } else
- tm->temp = DEFAULT_NO_ADC_TEMP;
-
- return 0;
-}
-
-/*
- * This function updates the internal temperature value based on the
- * current thermal stage and threshold as well as the previous stage
- */
-static int pm8901_tm_update_temp(struct pm8901_tm_device *tm)
-{
- unsigned int stage;
- int rc;
- u8 reg;
-
- rc = pm8901_tm_read_ctrl(tm->pm_chip, ®);
- if (rc < 0)
- return rc;
-
- stage = (reg & PM8901_TEMP_STATUS_MASK) >> PM8901_TEMP_STATUS_SHIFT;
- tm->thresh = (reg & PM8901_TEMP_THRESH_MASK) >>
- PM8901_TEMP_THRESH_SHIFT;
-
- if (stage > tm->stage) {
- /* increasing stage, use lower bound */
- tm->temp = (stage-1) * PM8901_TEMP_STAGE_STEP +
- tm->thresh * PM8901_TEMP_THRESH_STEP +
- PM8901_TEMP_STAGE_HYSTERESIS +
- PM8901_TEMP_THRESH_MIN;
- } else if (stage < tm->stage) {
- /* decreasing stage, use upper bound */
- tm->temp = stage * PM8901_TEMP_STAGE_STEP +
- tm->thresh * PM8901_TEMP_THRESH_STEP -
- PM8901_TEMP_STAGE_HYSTERESIS +
- PM8901_TEMP_THRESH_MIN;
- }
-
- tm->stage = stage;
-
- return 0;
-}
-
-static int pm8901_tz_get_temp(struct thermal_zone_device *thermal,
- unsigned long *temp)
-{
- struct pm8901_tm_device *tm = thermal->devdata;
- int rc;
-
- if (!tm || !temp)
- return -EINVAL;
-
- rc = pm8901_tm_update_temp(tm);
- if (rc < 0)
- return rc;
-
- *temp = tm->temp;
-
- return 0;
-}
-
-static int pm8901_tz_get_mode(struct thermal_zone_device *thermal,
- enum thermal_device_mode *mode)
-{
- struct pm8901_tm_device *tm = thermal->devdata;
-
- if (!tm || !mode)
- return -EINVAL;
-
- *mode = tm->mode;
-
- return 0;
-}
-
-static int pm8901_tz_set_mode(struct thermal_zone_device *thermal,
- enum thermal_device_mode mode)
-{
- struct pm8901_tm_device *tm = thermal->devdata;
-
- if (!tm)
- return -EINVAL;
-
- if (mode != tm->mode) {
- pr_info("%s: mode: %d --> %d\n", __func__, tm->mode, mode);
-
- if (mode == THERMAL_DEVICE_ENABLED)
- pm8901_tm_shutdown_override(tm->pm_chip,
- SOFTWARE_OVERRIDE_ENABLED);
- else
- pm8901_tm_shutdown_override(tm->pm_chip,
- SOFTWARE_OVERRIDE_DISABLED);
- }
- tm->mode = mode;
-
- return 0;
-}
-
-static int pm8901_tz_get_trip_type(struct thermal_zone_device *thermal,
- int trip, enum thermal_trip_type *type)
-{
- struct pm8901_tm_device *tm = thermal->devdata;
-
- if (!tm || trip < 0 || !type)
- return -EINVAL;
-
- switch (trip) {
- case PM8901_TRIP_STAGE3:
- *type = THERMAL_TRIP_CRITICAL;
- break;
- case PM8901_TRIP_STAGE2:
- *type = THERMAL_TRIP_HOT;
- break;
- case PM8901_TRIP_STAGE1:
- *type = THERMAL_TRIP_HOT;
- break;
- default:
- return -EINVAL;
- }
-
- return 0;
-}
-
-static int pm8901_tz_get_trip_temp(struct thermal_zone_device *thermal,
- int trip, unsigned long *temp)
-{
- struct pm8901_tm_device *tm = thermal->devdata;
- int thresh_temp;
-
- if (!tm || trip < 0 || !temp)
- return -EINVAL;
-
- thresh_temp = tm->thresh * PM8901_TEMP_THRESH_STEP +
- PM8901_TEMP_THRESH_MIN;
-
- switch (trip) {
- case PM8901_TRIP_STAGE3:
- thresh_temp += 2 * PM8901_TEMP_STAGE_STEP;
- break;
- case PM8901_TRIP_STAGE2:
- thresh_temp += PM8901_TEMP_STAGE_STEP;
- break;
- case PM8901_TRIP_STAGE1:
- break;
- default:
- return -EINVAL;
- }
- *temp = thresh_temp;
-
- return 0;
-}
-
-static int pm8901_tz_get_crit_temp(struct thermal_zone_device *thermal,
- unsigned long *temp)
-{
- struct pm8901_tm_device *tm = thermal->devdata;
-
- if (!tm || !temp)
- return -EINVAL;
-
- *temp = tm->thresh * PM8901_TEMP_THRESH_STEP +
- PM8901_TEMP_THRESH_MIN + 2 * PM8901_TEMP_STAGE_STEP;
-
- return 0;
-}
-
-static struct thermal_zone_device_ops pm8901_thermal_zone_ops = {
- .get_temp = pm8901_tz_get_temp,
- .get_mode = pm8901_tz_get_mode,
- .set_mode = pm8901_tz_set_mode,
- .get_trip_type = pm8901_tz_get_trip_type,
- .get_trip_temp = pm8901_tz_get_trip_temp,
- .get_crit_temp = pm8901_tz_get_crit_temp,
-};
-
-static irqreturn_t pm8901_tm_isr(int irq, void *data)
-{
- struct pm8901_tm_device *tm = data;
- int rc;
- u8 reg;
-
- rc = pm8901_tm_update_temp(tm);
- if (rc < 0)
- goto isr_handled;
-
- rc = pm8901_tm_read_ctrl(tm->pm_chip, ®);
- if (rc < 0)
- goto isr_handled;
-
- pr_info("%s: Temp Alarm - stage=%u, threshold=%u, temp=%lu\n",
- __func__, tm->stage, tm->thresh, tm->temp);
-
- if (reg & (PM8901_TEMP_ST2_SD | PM8901_TEMP_ST3_SD)) {
- reg &= ~(PM8901_TEMP_ST2_SD | PM8901_TEMP_ST3_SD |
- PM8901_TEMP_STATUS_MASK);
-
- pm8901_tm_write_ctrl(tm->pm_chip, reg);
- }
-
- thermal_zone_device_update(tm->tz_dev);
-
- /* Notify user space */
- if (tm->mode == THERMAL_DEVICE_ENABLED)
- kobject_uevent(&tm->tz_dev->device.kobj, KOBJ_CHANGE);
-
-isr_handled:
- return IRQ_HANDLED;
-}
-
-static irqreturn_t pm8901_tm_isr1(int irq, void *data)
-{
- struct pm8901_tm_device *tm = data;
- irqreturn_t rc;
-
- disable_irq(tm->hi_irq);
- rc = pm8901_tm_isr(irq, data);
- enable_irq(tm->hi_irq);
-
- return rc;
-}
-
-static irqreturn_t pm8901_tm_isr2(int irq, void *data)
-{
- struct pm8901_tm_device *tm = data;
- irqreturn_t rc;
-
- disable_irq(tm->irq);
- rc = pm8901_tm_isr(irq, data);
- enable_irq(tm->irq);
-
- return rc;
-}
-
-static int pm8901_tm_init_reg(struct pm8901_tm_device *tm)
-{
- int rc;
- u8 reg;
-
- rc = pm8901_tm_init_temp(tm);
- if (rc < 0)
- return rc;
-
- /* Use temperature threshold set 0: (105, 125, 145) */
- tm->thresh = 0;
- reg = (tm->thresh << PM8901_TEMP_THRESH_SHIFT) &
- PM8901_TEMP_THRESH_MASK;
- rc = pm8901_tm_write_ctrl(tm->pm_chip, reg);
- if (rc < 0)
- return rc;
-
- /*
- * Set the PMIC alarm module PWM to have a frequency of 8 Hz. This
- * helps cut down on the number of unnecessary interrupts fired when
- * changing between thermal stages. Also, Enable the over temperature
- * PWM whenever the PMIC is enabled.
- */
- reg = 1 << PM8901_TEMP_PWM_EN_SHIFT |
- 3 << PM8901_TEMP_PWM_PER_PRE_SHIFT |
- 3 << PM8901_TEMP_PWM_PER_DIV_SHIFT;
-
- rc = pm8901_tm_write_pwm(tm->pm_chip, reg);
-
- return rc;
-}
-
-static int __devinit pmic8901_tm_probe(struct platform_device *pdev)
-{
- struct pm8901_tm_device *tmdev;
- struct pm8901_chip *pm_chip;
- unsigned int irq, hi_irq;
- int rc;
-
- pm_chip = dev_get_drvdata(pdev->dev.parent);
- if (pm_chip == NULL) {
- pr_err("%s: no driver data passed in.\n", __func__);
- return -EFAULT;
- }
-
- irq = platform_get_irq(pdev, 0);
- if (!irq) {
- pr_err("%s: no IRQ passed in.\n", __func__);
- return -EFAULT;
- }
- hi_irq = platform_get_irq(pdev, 1);
- if (!hi_irq) {
- pr_err("%s: no HI IRQ passed in.\n", __func__);
- return -EFAULT;
- }
-
- tmdev = kzalloc(sizeof *tmdev, GFP_KERNEL);
- if (tmdev == NULL) {
- pr_err("%s: kzalloc() failed.\n", __func__);
- return -ENOMEM;
- }
-
- tmdev->pm_chip = pm_chip;
- tmdev->tz_dev = thermal_zone_device_register("pm8901_tz",
- PM8901_TRIP_NUM, tmdev,
- &pm8901_thermal_zone_ops,
- 0, 0, 0, 0);
- if (tmdev->tz_dev == NULL) {
- pr_err("%s: thermal_zone_device_register() failed.\n",
- __func__);
- kfree(tmdev);
- return -ENODEV;
- }
-
- rc = pm8901_tm_init_reg(tmdev);
- pm8901_tm_shutdown_override(tmdev->pm_chip, SOFTWARE_OVERRIDE_DISABLED);
- if (rc < 0) {
- thermal_zone_device_unregister(tmdev->tz_dev);
- kfree(tmdev);
- return rc;
- }
-
- /* start in HW control, switch to SW control when user changes mode */
- tmdev->mode = THERMAL_DEVICE_DISABLED;
- thermal_zone_device_update(tmdev->tz_dev);
-
- platform_set_drvdata(pdev, tmdev);
-
- rc = request_threaded_irq(irq, pm8901_tm_isr1, NULL,
- IRQF_TRIGGER_RISING | IRQF_DISABLED,
- "pm8901-tm-irq", tmdev);
- if (rc < 0) {
- pr_err("%s: request_threaded_irq(%d) FAIL: %d\n",
- __func__, irq, rc);
-
- thermal_zone_device_unregister(tmdev->tz_dev);
- platform_set_drvdata(pdev, tmdev->pm_chip);
- kfree(tmdev);
- return -ENODEV;
- }
- tmdev->irq = irq;
-
- rc = request_threaded_irq(hi_irq, pm8901_tm_isr2, NULL,
- IRQF_TRIGGER_RISING | IRQF_DISABLED,
- "pm8901-tm-irq2", tmdev);
- if (rc < 0) {
- pr_err("%s: request_threaded_irq(%d) FAIL: %d\n",
- __func__, hi_irq, rc);
-
- free_irq(irq, tmdev);
- thermal_zone_device_unregister(tmdev->tz_dev);
- platform_set_drvdata(pdev, tmdev->pm_chip);
- kfree(tmdev);
- return -ENODEV;
- }
- tmdev->hi_irq = hi_irq;
-
- pr_notice("%s: OK\n", __func__);
- return 0;
-}
-
-static int __devexit pmic8901_tm_remove(struct platform_device *pdev)
-{
- struct pm8901_tm_device *tmdev = platform_get_drvdata(pdev);
-
- free_irq(tmdev->hi_irq, tmdev);
- free_irq(tmdev->irq, tmdev);
- thermal_zone_device_unregister(tmdev->tz_dev);
- platform_set_drvdata(pdev, tmdev->pm_chip);
- pm8901_tm_shutdown_override(tmdev->pm_chip, SOFTWARE_OVERRIDE_DISABLED);
- kfree(tmdev);
-
- return 0;
-}
-
-#ifdef CONFIG_PM
-static int pmic8901_tm_suspend(struct device *dev)
-{
- struct platform_device *pdev = to_platform_device(dev);
- struct pm8901_tm_device *tm = platform_get_drvdata(pdev);
-
- pm8901_tm_shutdown_override(tm->pm_chip, SOFTWARE_OVERRIDE_DISABLED);
-
- return 0;
-}
-
-static int pmic8901_tm_resume(struct device *dev)
-{
- struct platform_device *pdev = to_platform_device(dev);
- struct pm8901_tm_device *tm = platform_get_drvdata(pdev);
-
- pm8901_tm_init_temp(tm);
-
- if (tm->mode == THERMAL_DEVICE_ENABLED)
- pm8901_tm_shutdown_override(tm->pm_chip,
- SOFTWARE_OVERRIDE_ENABLED);
-
- return 0;
-}
-
-static const struct dev_pm_ops pmic8901_tm_pm_ops = {
- .suspend = pmic8901_tm_suspend,
- .resume = pmic8901_tm_resume,
-};
-
-#define PM8901_TM_PM_OPS (&pmic8901_tm_pm_ops)
-#else
-#define PM8901_TM_PM_OPS NULL
-#endif
-
-static struct platform_driver pmic8901_tm_driver = {
- .probe = pmic8901_tm_probe,
- .remove = __devexit_p(pmic8901_tm_remove),
- .driver = {
- .name = "pm8901-tm",
- .owner = THIS_MODULE,
- .pm = PM8901_TM_PM_OPS,
- },
-};
-
-static int __init pm8901_tm_init(void)
-{
- return platform_driver_register(&pmic8901_tm_driver);
-}
-
-static void __exit pm8901_tm_exit(void)
-{
- platform_driver_unregister(&pmic8901_tm_driver);
-}
-
-module_init(pm8901_tm_init);
-module_exit(pm8901_tm_exit);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("PMIC8901 Thermal Manager driver");
-MODULE_VERSION("1.0");
-MODULE_ALIAS("platform:pmic8901-tm");
diff --git a/include/linux/input/pmic8058-keypad.h b/include/linux/input/pmic8058-keypad.h
deleted file mode 100644
index a2fd6ac..0000000
--- a/include/linux/input/pmic8058-keypad.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * 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.
- *
- */
-
-#ifndef __PMIC8058_KEYPAD_H__
-#define __PMIC8058_KEYPAD_H__
-
-#include <linux/input/matrix_keypad.h>
-
-/*
- * NOTE: Assumption of maximum of five revisions
- * of PMIC8058 chip.
- */
-#define MAX_PM8058_REVS 0x5
-
-struct pmic8058_keypad_data {
- const struct matrix_keymap_data *keymap_data;
-
- const char *input_name;
- const char *input_phys_device;
-
- unsigned int num_cols;
- unsigned int num_rows;
-
- unsigned int rows_gpio_start;
- unsigned int cols_gpio_start;
-
- unsigned int debounce_ms[MAX_PM8058_REVS];
- unsigned int scan_delay_ms;
- unsigned int row_hold_ns;
-
- int keymap_size;
- const unsigned int *keymap;
-
- unsigned int wakeup;
- unsigned int rep;
-};
-
-#endif /*__PMIC8058_KEYPAD_H__ */
diff --git a/include/linux/pmic8058-batt-alarm.h b/include/linux/pmic8058-batt-alarm.h
deleted file mode 100644
index 0a0ac78..0000000
--- a/include/linux/pmic8058-batt-alarm.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * 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.
- */
-/*
- * Qualcomm PMIC 8058 Battery Alarm Device driver
- *
- */
-#ifndef __PMIC8058_BATT_ALARM_H__
-#define __PMIC8058_BATT_ALARM_H__
-
-#include <linux/bitops.h>
-
-/**
- * enum pm8058_batt_alarm_hold_time - hold time required for out of range
- * battery voltage needed to trigger a status change. Enum names denote
- * hold time in milliseconds.
- */
-enum pm8058_batt_alarm_hold_time {
- PM8058_BATT_ALARM_HOLD_TIME_0p125_MS = 0,
- PM8058_BATT_ALARM_HOLD_TIME_0p25_MS,
- PM8058_BATT_ALARM_HOLD_TIME_0p5_MS,
- PM8058_BATT_ALARM_HOLD_TIME_1_MS,
- PM8058_BATT_ALARM_HOLD_TIME_2_MS,
- PM8058_BATT_ALARM_HOLD_TIME_4_MS,
- PM8058_BATT_ALARM_HOLD_TIME_8_MS,
- PM8058_BATT_ALARM_HOLD_TIME_16_MS,
-};
-
-/*
- * Bits that are set in the return value of pm8058_batt_alarm_status_read
- * to indicate crossing of the upper or lower threshold.
- */
-#define PM8058_BATT_ALARM_STATUS_BELOW_LOWER BIT(0)
-#define PM8058_BATT_ALARM_STATUS_ABOVE_UPPER BIT(1)
-
-/**
- * pm8058_batt_alarm_state_set - enable or disable the threshold comparators
- * @enable_lower_comparator: 1 = enable comparator, 0 = disable comparator
- * @enable_upper_comparator: 1 = enable comparator, 0 = disable comparator
- *
- * RETURNS: an appropriate -ERRNO error value on error, or zero for success.
- */
-int pm8058_batt_alarm_state_set(int enable_lower_comparator,
- int enable_upper_comparator);
-
-/**
- * pm8058_batt_alarm_threshold_set - set the lower and upper alarm thresholds
- * @lower_threshold_mV: battery undervoltage threshold in millivolts
- * @upper_threshold_mV: battery overvoltage threshold in millivolts
- *
- * RETURNS: an appropriate -ERRNO error value on error, or zero for success.
- */
-int pm8058_batt_alarm_threshold_set(int lower_threshold_mV,
- int upper_threshold_mV);
-
-/**
- * pm8058_batt_alarm_status_read - get status of both threshold comparators
- *
- * RETURNS: < 0 = error
- * 0 = battery voltage ok
- * BIT(0) set = battery voltage below lower threshold
- * BIT(1) set = battery voltage above upper threshold
- */
-int pm8058_batt_alarm_status_read(void);
-
-/**
- * pm8058_batt_alarm_register_notifier - register a notifier to run when a
- * battery voltage change interrupt fires
- * @nb: notifier block containing callback function to register
- *
- * nb->notifier_call must point to a function of this form -
- * int (*notifier_call)(struct notifier_block *nb, unsigned long status,
- * void *unused);
- * "status" will receive the battery alarm status; "unused" will be NULL.
- *
- * RETURNS: an appropriate -ERRNO error value on error, or zero for success.
- */
-int pm8058_batt_alarm_register_notifier(struct notifier_block *nb);
-
-/**
- * pm8058_batt_alarm_unregister_notifier - unregister a notifier that is run
- * when a battery voltage change interrupt fires
- * @nb: notifier block containing callback function to unregister
- *
- * RETURNS: an appropriate -ERRNO error value on error, or zero for success.
- */
-int pm8058_batt_alarm_unregister_notifier(struct notifier_block *nb);
-
-/**
- * pm8058_batt_alarm_hold_time_set - set hold time of interrupt output *
- * @hold_time: amount of time that battery voltage must remain outside of the
- * threshold range before the battery alarm interrupt triggers
- *
- * RETURNS: an appropriate -ERRNO error value on error, or zero for success.
- */
-int pm8058_batt_alarm_hold_time_set(enum pm8058_batt_alarm_hold_time hold_time);
-
-/**
- * pm8058_batt_alarm_pwm_rate_set - set battery alarm update rate *
- * @use_pwm: 1 = use PWM update rate, 0 = comparators always active
- * @clock_scaler: PWM clock scaler = 2 to 9
- * @clock_divider: PWM clock divider = 2 to 8
- *
- * This function sets the rate at which the battery alarm module enables
- * the threshold comparators. The rate is determined by the following equation:
- *
- * f_update = (1024 Hz) / (clock_divider * (2 ^ clock_scaler))
- *
- * Thus, the update rate can range from 0.25 Hz to 128 Hz.
- *
- * RETURNS: an appropriate -ERRNO error value on error, or zero for success.
- */
-int pm8058_batt_alarm_pwm_rate_set(int use_pwm, int clock_scaler,
- int clock_divider);
-
-#endif /* __PMIC8058_BATT_ALARM_H__ */
diff --git a/include/linux/pmic8058-misc.h b/include/linux/pmic8058-misc.h
deleted file mode 100644
index 5675a93..0000000
--- a/include/linux/pmic8058-misc.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * 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.
- */
-
-
-#ifndef __PMIC8058_MISC_H__
-#define __PMIC8058_MISC_H__
-
-enum pm8058_vib_en_mode {
- PM8058_VIB_MANUAL,
- PM8058_VIB_DTEST1,
- PM8058_VIB_DTEST2,
- PM8058_VIB_DTEST3
-};
-
-enum pm8058_coincell_chg_voltage {
- PM8058_COINCELL_VOLTAGE_3p2V = 1,
- PM8058_COINCELL_VOLTAGE_3p1V,
- PM8058_COINCELL_VOLTAGE_3p0V,
- PM8058_COINCELL_VOLTAGE_2p5V = 16
-};
-
-enum pm8058_coincell_chg_resistor {
- PM8058_COINCELL_RESISTOR_2100_OHMS,
- PM8058_COINCELL_RESISTOR_1700_OHMS,
- PM8058_COINCELL_RESISTOR_1200_OHMS,
- PM8058_COINCELL_RESISTOR_800_OHMS
-};
-
-enum pm8058_coincell_chg_state {
- PM8058_COINCELL_CHG_DISABLE,
- PM8058_COINCELL_CHG_ENABLE
-};
-
-struct pm8058_vib_config {
- u16 drive_mV;
- u8 active_low;
- enum pm8058_vib_en_mode enable_mode;
-};
-
-struct pm8058_coincell_chg_config {
- enum pm8058_coincell_chg_state state;
- enum pm8058_coincell_chg_voltage voltage;
- enum pm8058_coincell_chg_resistor resistor;
-};
-
-int pm8058_vibrator_config(struct pm8058_vib_config *vib_config);
-int pm8058_coincell_chg_config(struct pm8058_coincell_chg_config *chg_config);
-
-#endif /* __PMIC8058_MISC_H__ */
diff --git a/include/linux/pmic8058-pwrkey.h b/include/linux/pmic8058-pwrkey.h
deleted file mode 100644
index 6953872..0000000
--- a/include/linux/pmic8058-pwrkey.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * 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.
- *
- */
-
-#ifndef __PMIC8058_PWRKEY_H__
-#define __PMIC8058_PWRKEY_H__
-
-struct pmic8058_pwrkey_pdata {
- bool pull_up;
- /* time after which pwr key event should be generated, if key is
- * released before that then end key event is reported
- */
- u16 pwrkey_time_ms;
- /* time delay for pwr-key state change
- * interrupt triggering.
- */
- u32 kpd_trigger_delay_us;
- u32 wakeup;
-};
-
-#endif /* __PMIC8058_PWRKEY_H__ */
diff --git a/include/linux/pmic8058-vibrator.h b/include/linux/pmic8058-vibrator.h
deleted file mode 100644
index e539058..0000000
--- a/include/linux/pmic8058-vibrator.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * 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.
- *
- */
-#ifndef __PMIC8058_VIBRATOR_H__
-#define __PMIC8058_VIBRATOR_H__
-
-struct pmic8058_vibrator_pdata {
- int initial_vibrate_ms;
- int max_timeout_ms;
-
- int level_mV;
-};
-
-#endif /* __PMIC8058_VIBRATOR_H__ */
diff --git a/include/linux/rtc/rtc-pm8058.h b/include/linux/rtc/rtc-pm8058.h
deleted file mode 100644
index 340fb2d..0000000
--- a/include/linux/rtc/rtc-pm8058.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * 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.
- *
- */
-
-#ifndef __RTC_PM8058_H__
-#define __RTC_PM8058_H__
-
-struct pm8058_rtc_platform_data {
- bool rtc_alarm_powerup;
-};
-
-#endif /* __RTC_PM8058_H__ */