Merge branch 'master' of git://gitorious.org/linux-on-wince-htc/linux_on_wince_htc
This commit is contained in:
commit
328721bbb8
@ -37,10 +37,13 @@
|
||||
#define LCMDBG(fmt, arg...) {}
|
||||
#endif
|
||||
|
||||
#define HTCLEO_DEFAULT_BACKLIGHT_BRIGHTNESS 255
|
||||
|
||||
static struct led_trigger *htcleo_lcd_backlight;
|
||||
static int auto_bl_state=0;
|
||||
static DEFINE_MUTEX(htcleo_backlight_lock);
|
||||
|
||||
int htcleo_brightness_autobacklight(uint8_t value)
|
||||
static int htcleo_brightness_autobacklight(uint8_t value)
|
||||
{
|
||||
int ret;
|
||||
uint8_t data[2];
|
||||
@ -73,16 +76,18 @@ static ssize_t htcleo_auto_bl_set(struct device *dev,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
int set_state;
|
||||
mutex_lock(&htcleo_backlight_lock);
|
||||
sscanf(buf, "%d", &set_state);
|
||||
if(set_state!=0 && set_state!=1) return -EINVAL;
|
||||
htcleo_brightness_autobacklight(set_state);
|
||||
mutex_unlock(&htcleo_backlight_lock);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
static DEVICE_ATTR(auto_bl, 0644, htcleo_auto_bl_get, htcleo_auto_bl_set);
|
||||
|
||||
int htcleo_brightness_onoff_bkl(int enable)
|
||||
static int htcleo_brightness_onoff_bkl(int enable)
|
||||
{
|
||||
int ret;
|
||||
uint8_t data[1];
|
||||
@ -94,7 +99,7 @@ int htcleo_brightness_onoff_bkl(int enable)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int htcleo_brightness_set_bkl(uint8_t value)
|
||||
static int htcleo_brightness_set_bkl(uint8_t value)
|
||||
{
|
||||
int ret;
|
||||
uint8_t cmd[2];
|
||||
@ -118,13 +123,14 @@ int htcleo_brightness_set_bkl(uint8_t value)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void htcleo_brightness_set(struct led_classdev *led_cdev, enum led_brightness val)
|
||||
static void htcleo_brightness_set(struct led_classdev *led_cdev, enum led_brightness val)
|
||||
{
|
||||
led_cdev->brightness = val;
|
||||
mutex_lock(&htcleo_backlight_lock);
|
||||
|
||||
// set brigtness level via MicroP
|
||||
LCMDBG("htcleo_brightness_set: %d\n", val);
|
||||
if (val > 255) val = 255;
|
||||
led_cdev->brightness = val;
|
||||
if (val < 30)
|
||||
{
|
||||
htcleo_brightness_onoff_bkl(0);
|
||||
@ -134,13 +140,20 @@ void htcleo_brightness_set(struct led_classdev *led_cdev, enum led_brightness va
|
||||
htcleo_brightness_onoff_bkl(1);
|
||||
htcleo_brightness_set_bkl((val - 30) / 23);
|
||||
}
|
||||
mutex_unlock(&htcleo_backlight_lock);
|
||||
}
|
||||
|
||||
static enum led_brightness htcleo_brightness_get(struct led_classdev *led_cdev)
|
||||
{
|
||||
return led_cdev->brightness;
|
||||
}
|
||||
|
||||
static struct led_classdev htcleo_backlight_led =
|
||||
{
|
||||
.name = "lcd-backlight",
|
||||
.brightness = LED_FULL,
|
||||
.brightness = HTCLEO_DEFAULT_BACKLIGHT_BRIGHTNESS,
|
||||
.brightness_set = htcleo_brightness_set,
|
||||
.brightness_get = htcleo_brightness_get,
|
||||
};
|
||||
|
||||
static int htcleo_backlight_probe(struct platform_device *pdev)
|
||||
|
@ -41,24 +41,6 @@
|
||||
|
||||
#define HTCLEO_MAX_BRIGHTNESS 255
|
||||
|
||||
int htcleo_brightness_autobacklight(uint8_t value)
|
||||
{
|
||||
int ret;
|
||||
uint8_t data[2];
|
||||
|
||||
LCMDBG("%s:(%d)\n", __func__, value);
|
||||
|
||||
data[0] = 1;
|
||||
data[1] = value;
|
||||
ret = microp_i2c_write(MICROP_I2C_WCMD_AUTO_BL_CTL, data, 2);
|
||||
if (ret != 0)
|
||||
pr_err("%s: set auto light sensor fail\n", __func__);
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(htcleo_brightness_autobacklight);
|
||||
|
||||
int htcleo_brightness_onoff_bkl(int enable)
|
||||
{
|
||||
int ret;
|
||||
@ -74,7 +56,7 @@ int htcleo_brightness_onoff_bkl(int enable)
|
||||
int htcleo_brightness_set_bkl(uint8_t value)
|
||||
{
|
||||
int ret;
|
||||
uint8_t cmd[2];
|
||||
uint8_t cmd[2], data[2];
|
||||
|
||||
LCMDBG("microp_set_bkl(%d)\n", value);
|
||||
|
||||
@ -82,9 +64,18 @@ int htcleo_brightness_set_bkl(uint8_t value)
|
||||
{
|
||||
value = 9;
|
||||
}
|
||||
// disable autobrigtness
|
||||
// CotullaTEST: Lsensor test, add 0x100
|
||||
// data[0] = 0;
|
||||
data[0] = 1;
|
||||
data[1] = 0;
|
||||
ret = microp_i2c_write(MICROP_I2C_WCMD_AUTO_BL_CTL, data, 2); // 23
|
||||
if (ret != 0)
|
||||
pr_err("%s: set auto light sensor fail\n", __func__);
|
||||
|
||||
// setvalue
|
||||
cmd[0] = value << 4;
|
||||
// printk("22LEVEL %02X\n", cmd[0]);
|
||||
ret = microp_i2c_write(MICROP_I2C_WCMD_LCM_BL_MANU_CTL, cmd, 1); // 22
|
||||
if (ret < 0)
|
||||
{
|
||||
@ -136,8 +127,6 @@ static struct backlight_ops htcleo_backlight_ops =
|
||||
static int htcleo_backlight_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct backlight_device *bd;
|
||||
ret = device_create_file(&client->dev, &dev_attr_reset);
|
||||
|
||||
bd = backlight_device_register("htcleo-backlight", &pdev->dev, NULL, &htcleo_backlight_ops);
|
||||
bd->props.max_brightness = HTCLEO_MAX_BRIGHTNESS;
|
||||
bd->props.brightness = HTCLEO_MAX_BRIGHTNESS;
|
||||
|
@ -26,8 +26,10 @@
|
||||
|
||||
#include "board-htcleo.h"
|
||||
|
||||
#define HTCLEO_DEFAULT_KEYPAD_BRIGHTNESS 0
|
||||
static DEFINE_MUTEX(htcleo_keypad_brightness_lock);
|
||||
|
||||
struct led_data {
|
||||
struct led_classdev ldev;
|
||||
struct mutex led_data_mutex;
|
||||
struct work_struct brightness_work;
|
||||
spinlock_t brightness_lock;
|
||||
@ -169,6 +171,7 @@ static void keypad_led_brightness_set(struct led_classdev *led_cdev,
|
||||
enum led_brightness brightness)
|
||||
{
|
||||
unsigned long flags;
|
||||
mutex_lock(&htcleo_keypad_brightness_lock);
|
||||
|
||||
pr_debug("Setting %s brightness current %d new %d\n",
|
||||
led_cdev->name, led_cdev->brightness, brightness);
|
||||
@ -182,8 +185,21 @@ static void keypad_led_brightness_set(struct led_classdev *led_cdev,
|
||||
spin_unlock_irqrestore(&keypad_led_data.brightness_lock, flags);
|
||||
|
||||
schedule_work(&keypad_led_data.brightness_work);
|
||||
mutex_unlock(&htcleo_keypad_brightness_lock);
|
||||
}
|
||||
|
||||
static enum led_brightness keypad_led_brightness_get(struct led_classdev *led_cdev)
|
||||
{
|
||||
return led_cdev->brightness;
|
||||
}
|
||||
|
||||
static struct led_classdev htcleo_backlight_led =
|
||||
{
|
||||
.name = "button-backlight",
|
||||
.brightness = HTCLEO_DEFAULT_KEYPAD_BRIGHTNESS,
|
||||
.brightness_set = keypad_led_brightness_set,
|
||||
.brightness_get = keypad_led_brightness_get,
|
||||
};
|
||||
|
||||
static int __init htcleo_init_keypad(void)
|
||||
{
|
||||
@ -214,15 +230,12 @@ static int __init htcleo_init_keypad(void)
|
||||
goto err_gpio_kpl;
|
||||
}
|
||||
|
||||
keypad_led_data.ldev.name = "button-backlight";
|
||||
keypad_led_data.ldev.brightness_set = keypad_led_brightness_set;
|
||||
keypad_led_data.oldval = 0;
|
||||
mutex_init(&keypad_led_data.led_data_mutex);
|
||||
INIT_WORK(&keypad_led_data.brightness_work, keypad_led_brightness_set_work);
|
||||
spin_lock_init(&keypad_led_data.brightness_lock);
|
||||
ret = led_classdev_register(&htcleo_input_device.dev, &keypad_led_data.ldev);
|
||||
ret = led_classdev_register(&htcleo_input_device.dev, &htcleo_backlight_led);
|
||||
if (ret) {
|
||||
keypad_led_data.ldev.name = NULL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -62,65 +62,81 @@
|
||||
|
||||
/* End EBI region */
|
||||
|
||||
#define HTCLEO_GPIO_PS_HOLD 25
|
||||
#define HTCLEO_GPIO_PS_HOLD 25
|
||||
|
||||
//#define HTCLEO_GPIO_UP_INT_N 35 // We have to find the right one
|
||||
#define HTCLEO_GPIO_UP_INT_N 90
|
||||
#define HTCLEO_GPIO_UP_RESET_N 91
|
||||
#define HTCLEO_GPIO_LS_EN_N 119
|
||||
#define HTCLEO_GPIO_UP_INT_N 90
|
||||
#define HTCLEO_GPIO_UP_RESET_N 91
|
||||
#define HTCLEO_GPIO_LS_EN_N 119
|
||||
|
||||
#define HTCLEO_GPIO_TP_INT_N 92
|
||||
#define HTCLEO_GPIO_TP_LS_EN 93
|
||||
#define HTCLEO_GPIO_TP_EN 160
|
||||
#define HTCLEO_GPIO_TP_INT_N 92
|
||||
#define HTCLEO_GPIO_TP_LS_EN 93
|
||||
#define HTCLEO_GPIO_TP_EN 160
|
||||
|
||||
#define HTCLEO_GPIO_POWER_KEY 94
|
||||
#define HTCLEO_GPIO_SD_STATUS 153
|
||||
#define HTCLEO_GPIO_POWER_KEY 94
|
||||
#define HTCLEO_GPIO_SD_STATUS 153
|
||||
|
||||
#define HTCLEO_GPIO_WIFI_SHUTDOWN_N 129
|
||||
#define HTCLEO_GPIO_WIFI_IRQ 152
|
||||
#define HTCLEO_GPIO_WIFI_SHUTDOWN_N 129
|
||||
#define HTCLEO_GPIO_WIFI_IRQ 152
|
||||
|
||||
#define HTCLEO_GPIO_VIBRATOR_ON 100
|
||||
#define HTCLEO_GPIO_VIBRATOR_ON 100
|
||||
|
||||
/* Flashlight */
|
||||
#define HTCLEO_GPIO_FLASHLIGHT_TORCH 159
|
||||
#define HTCLEO_GPIO_FLASHLIGHT_FLASH 143
|
||||
#define HTCLEO_GPIO_FLASHLIGHT_TORCH 159
|
||||
#define HTCLEO_GPIO_FLASHLIGHT_FLASH 143
|
||||
|
||||
|
||||
|
||||
#define HTCLEO_AUD_JACKHP_EN 157
|
||||
#define HTCLEO_AUD_2V5_EN 158
|
||||
#define HTCLEO_BT_PCM_OUT 68
|
||||
#define HTCLEO_BT_PCM_IN 69
|
||||
#define HTCLEO_BT_PCM_SYNC 70
|
||||
#define HTCLEO_BT_PCM_CLK 71
|
||||
#define HTCLEO_AUD_JACKHP_EN 157
|
||||
#define HTCLEO_AUD_2V5_EN 158
|
||||
#define HTCLEO_BT_PCM_OUT 68
|
||||
#define HTCLEO_BT_PCM_IN 69
|
||||
#define HTCLEO_BT_PCM_SYNC 70
|
||||
#define HTCLEO_BT_PCM_CLK 71
|
||||
|
||||
/* Headset */
|
||||
#define HTCLEO_GPIO_HDS_MIC 35
|
||||
#define HTCLEO_GPIO_HDS_DET 145
|
||||
#define HTCLEO_GPIO_HDS_MIC 35
|
||||
#define HTCLEO_GPIO_HDS_DET 145
|
||||
|
||||
/* Keypad */
|
||||
#define HTCLEO_GPIO_KP_MKOUT0 33
|
||||
#define HTCLEO_GPIO_KP_MKOUT1 32
|
||||
#define HTCLEO_GPIO_KP_MKOUT2 31
|
||||
#define HTCLEO_GPIO_KP_MPIN0 42
|
||||
#define HTCLEO_GPIO_KP_MPIN1 41
|
||||
#define HTCLEO_GPIO_KP_MPIN2 40
|
||||
#define HTCLEO_GPIO_KP_LED 48
|
||||
#define HTCLEO_GPIO_KP_MKOUT0 33
|
||||
#define HTCLEO_GPIO_KP_MKOUT1 32
|
||||
#define HTCLEO_GPIO_KP_MKOUT2 31
|
||||
#define HTCLEO_GPIO_KP_MPIN0 42
|
||||
#define HTCLEO_GPIO_KP_MPIN1 41
|
||||
#define HTCLEO_GPIO_KP_MPIN2 40
|
||||
#define HTCLEO_GPIO_KP_LED 48
|
||||
|
||||
/* Bluetooth */
|
||||
#define HTCLEO_GPIO_BT_UART1_RTS 43
|
||||
#define HTCLEO_GPIO_BT_UART1_CTS 44
|
||||
#define HTCLEO_GPIO_BT_UART1_RX 45
|
||||
#define HTCLEO_GPIO_BT_UART1_TX 46
|
||||
#define HTCLEO_GPIO_BT_RESET_N 146
|
||||
#define HTCLEO_GPIO_BT_SHUTDOWN_N 128
|
||||
#define HTCLEO_GPIO_BT_HOST_WAKE 37
|
||||
#define HTCLEO_GPIO_BT_CHIP_WAKE 57
|
||||
#define HTCLEO_GPIO_BT_UART1_RTS 43
|
||||
#define HTCLEO_GPIO_BT_UART1_CTS 44
|
||||
#define HTCLEO_GPIO_BT_UART1_RX 45
|
||||
#define HTCLEO_GPIO_BT_UART1_TX 46
|
||||
#define HTCLEO_GPIO_BT_RESET_N 146
|
||||
#define HTCLEO_GPIO_BT_SHUTDOWN_N 128
|
||||
#define HTCLEO_GPIO_BT_HOST_WAKE 37
|
||||
#define HTCLEO_GPIO_BT_CHIP_WAKE 57
|
||||
|
||||
/* Battery */
|
||||
#define HTCLEO_GPIO_BATTERY_CHARGER_ENABLE 22
|
||||
#define HTCLEO_GPIO_BATTERY_CHARGER_CURRENT 16
|
||||
#define HTCLEO_GPIO_BATTERY_OVER_CHG 147
|
||||
#define HTCLEO_GPIO_POWER_USB 109
|
||||
#define HTCLEO_GPIO_USBPHY_3V3_ENABLE 104
|
||||
|
||||
/* Touchscreen */
|
||||
#define HTCLEO_GPIO_TS_POWER 160
|
||||
#define HTCLEO_GPIO_TS_IRQ 92
|
||||
#define HTCLEO_GPIO_TS_SEL 108
|
||||
#define HTCLEO_GPIO_TS_MULT 82
|
||||
#define HTCLEO_GPIO_H2W_CLK 27
|
||||
|
||||
#define HTCLEO_GPIO_LED_3V3_EN 85
|
||||
|
||||
|
||||
/* Compass */
|
||||
#define HTCLEO_GPIO_COMPASS_INT_N 39
|
||||
#define HTCLEO_GPIO_COMPASS_RST_N 107
|
||||
#define HTCLEO_PROJECT_NAME "htcleo"
|
||||
#define HTCLEO_GPIO_COMPASS_INT_N 39
|
||||
#define HTCLEO_GPIO_COMPASS_RST_N 107
|
||||
#define HTCLEO_PROJECT_NAME "htcleo"
|
||||
#define HTCLEO_LAYOUTS { \
|
||||
{ { 0, 1, 0}, { -1, 0, 0}, { 0, 0, 1} }, \
|
||||
{ { 0, -1, 0}, { 1, 0, 0}, { 0, 0, -1} }, \
|
||||
@ -131,40 +147,28 @@
|
||||
/* Display */
|
||||
#define HTCLEO_GPIO_LCM_POWER 88
|
||||
#define HTCLEO_GPIO_LCM_RESET 29
|
||||
#define HTCLEO_LCD_R1 (114)
|
||||
#define HTCLEO_LCD_R2 (115)
|
||||
#define HTCLEO_LCD_R3 (116)
|
||||
#define HTCLEO_LCD_R4 (117)
|
||||
#define HTCLEO_LCD_R5 (118)
|
||||
#define HTCLEO_LCD_G0 (121)
|
||||
#define HTCLEO_LCD_G1 (122)
|
||||
#define HTCLEO_LCD_G2 (123)
|
||||
#define HTCLEO_LCD_G3 (124)
|
||||
#define HTCLEO_LCD_G4 (125)
|
||||
#define HTCLEO_LCD_G5 (126)
|
||||
#define HTCLEO_LCD_B1 (130)
|
||||
#define HTCLEO_LCD_B2 (131)
|
||||
#define HTCLEO_LCD_B3 (132)
|
||||
#define HTCLEO_LCD_B4 (133)
|
||||
#define HTCLEO_LCD_B5 (134)
|
||||
#define HTCLEO_LCD_PCLK (135)
|
||||
#define HTCLEO_LCD_VSYNC (136)
|
||||
#define HTCLEO_LCD_HSYNC (137)
|
||||
#define HTCLEO_LCD_DE (138)
|
||||
#define HTCLEO_LCD_R1 (114)
|
||||
#define HTCLEO_LCD_R2 (115)
|
||||
#define HTCLEO_LCD_R3 (116)
|
||||
#define HTCLEO_LCD_R4 (117)
|
||||
#define HTCLEO_LCD_R5 (118)
|
||||
#define HTCLEO_LCD_G0 (121)
|
||||
#define HTCLEO_LCD_G1 (122)
|
||||
#define HTCLEO_LCD_G2 (123)
|
||||
#define HTCLEO_LCD_G3 (124)
|
||||
#define HTCLEO_LCD_G4 (125)
|
||||
#define HTCLEO_LCD_G5 (126)
|
||||
#define HTCLEO_LCD_B1 (130)
|
||||
#define HTCLEO_LCD_B2 (131)
|
||||
#define HTCLEO_LCD_B3 (132)
|
||||
#define HTCLEO_LCD_B4 (133)
|
||||
#define HTCLEO_LCD_B5 (134)
|
||||
#define HTCLEO_LCD_PCLK (135)
|
||||
#define HTCLEO_LCD_VSYNC (136)
|
||||
#define HTCLEO_LCD_HSYNC (137)
|
||||
#define HTCLEO_LCD_DE (138)
|
||||
|
||||
|
||||
/* Battery */
|
||||
#define HTCLEO_GPIO_BATTERY_CHARGER_ENABLE 22
|
||||
#define HTCLEO_GPIO_BATTERY_CHARGER_CURRENT 16
|
||||
#define HTCLEO_GPIO_BATTERY_OVER_CHG 147
|
||||
#define HTCLEO_GPIO_POWER_USB 109
|
||||
#define HTCLEO_GPIO_USBPHY_3V3_ENABLE 104
|
||||
|
||||
/* Touchscreen */
|
||||
#define HTCLEO_GPIO_TS_POWER 160
|
||||
#define HTCLEO_GPIO_TS_IRQ 92
|
||||
#define HTCLEO_GPIO_TS_SEL 108
|
||||
|
||||
#define HTCLEO_GPIO_LED_3V3_EN 85
|
||||
|
||||
int htcleo_pm_set_vreg(int enable, unsigned id);
|
||||
int __init htcleo_init_panel(void);
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <mach/camera.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/wakelock.h>
|
||||
#include <linux/earlysuspend.h>
|
||||
|
||||
static uint16_t g_usModuleVersion; /*0: rev.4, 1: rev.5 */
|
||||
|
||||
@ -1689,8 +1690,16 @@ struct s5k3e2fx_ctrl {
|
||||
enum msm_s_test_mode set_test;
|
||||
};
|
||||
|
||||
struct s5k3e2fx_waitevent{
|
||||
uint32_t waked_up;
|
||||
wait_queue_head_t event_wait;
|
||||
};
|
||||
static struct s5k3e2fx_waitevent s5k3e2fx_event;
|
||||
static struct platform_device *s5k3e2fx_pdev;
|
||||
|
||||
static struct s5k3e2fx_ctrl *s5k3e2fx_ctrl;
|
||||
static DECLARE_WAIT_QUEUE_HEAD(s5k3e2fx_wait_queue);
|
||||
DECLARE_MUTEX(s5k3e2fx_sem);
|
||||
|
||||
#define MAX_I2C_RETRIES 20
|
||||
static int i2c_transfer_retry(struct i2c_adapter *adap,
|
||||
@ -2319,8 +2328,26 @@ static int s5k3e2fx_setting(enum msm_s_reg_update rupdate,
|
||||
|
||||
static int s5k3e2fx_sensor_open_init(const struct msm_camera_sensor_info *data)
|
||||
{
|
||||
int rc;
|
||||
int rc=0;
|
||||
int timeout;
|
||||
|
||||
|
||||
down(&s5k3e2fx_sem);
|
||||
|
||||
/*check whether resume done*/
|
||||
timeout = wait_event_interruptible_timeout(
|
||||
s5k3e2fx_event.event_wait,
|
||||
s5k3e2fx_event.waked_up,
|
||||
30*HZ);
|
||||
|
||||
pr_info("wait event : %d timeout:%d\n",
|
||||
s5k3e2fx_event.waked_up, timeout);
|
||||
if (timeout == 0) {
|
||||
up(&s5k3e2fx_sem);
|
||||
return rc;
|
||||
}
|
||||
|
||||
msm_camio_probe_on(s5k3e2fx_pdev);
|
||||
CDBG("%s %s:%d\n", __FILE__, __func__, __LINE__);
|
||||
s5k3e2fx_ctrl = kzalloc(sizeof(struct s5k3e2fx_ctrl), GFP_KERNEL);
|
||||
if (!s5k3e2fx_ctrl) {
|
||||
@ -2369,6 +2396,7 @@ static int s5k3e2fx_sensor_open_init(const struct msm_camera_sensor_info *data)
|
||||
init_fail1:
|
||||
kfree(s5k3e2fx_ctrl);
|
||||
init_done:
|
||||
up(&s5k3e2fx_sem);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -2406,6 +2434,8 @@ static int s5k3e2fx_sensor_release(void)
|
||||
|
||||
s5k3e2fx_suspend_sensor();
|
||||
|
||||
msm_camio_probe_off(s5k3e2fx_pdev);
|
||||
|
||||
kfree(s5k3e2fx_ctrl);
|
||||
s5k3e2fx_ctrl = NULL;
|
||||
|
||||
@ -2901,39 +2931,6 @@ static int s5k3e2fx_sensor_config(void __user *argp)
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int s5k3e2fx_sensor_probe(const struct msm_camera_sensor_info *info,
|
||||
struct msm_sensor_ctrl *s)
|
||||
{
|
||||
int rc = 0;
|
||||
pr_info("%s\n", __func__);
|
||||
|
||||
rc = i2c_add_driver(&s5k3e2fx_i2c_driver);
|
||||
if (rc < 0 || s5k3e2fx_client == NULL) {
|
||||
rc = -ENOTSUPP;
|
||||
goto probe_fail;
|
||||
}
|
||||
|
||||
msm_camio_clk_rate_set(S5K3E2FX_DEF_MCLK);
|
||||
msleep(20);
|
||||
|
||||
rc = s5k3e2fx_probe_init_sensor(info);
|
||||
if (rc < 0)
|
||||
goto probe_fail;
|
||||
|
||||
/* lens correction */
|
||||
s5k3e2fx_probe_init_lens_correction(info);
|
||||
init_suspend();
|
||||
|
||||
s->s_init = s5k3e2fx_sensor_open_init;
|
||||
s->s_release = s5k3e2fx_sensor_release;
|
||||
s->s_config = s5k3e2fx_sensor_config;
|
||||
|
||||
return rc;
|
||||
|
||||
probe_fail:
|
||||
pr_err("SENSOR PROBE FAILS!\n");
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int s5k3e2fx_suspend(struct platform_device *pdev, pm_message_t state)
|
||||
{
|
||||
@ -2943,6 +2940,8 @@ static int s5k3e2fx_suspend(struct platform_device *pdev, pm_message_t state)
|
||||
if (!sinfo->need_suspend)
|
||||
return 0;
|
||||
|
||||
s5k3e2fx_event.waked_up = 0;
|
||||
|
||||
CDBG("s5k3e2fx: camera suspend\n");
|
||||
rc = gpio_request(sinfo->sensor_reset, "s5k3e2fx");
|
||||
if (!rc)
|
||||
@ -3035,17 +3034,22 @@ static void s5k3e2fx_sensor_resume_setting(void)
|
||||
s5k3e2fx_i2c_write_b(s5k3e2fx_client->addr, 0x0202, 0x03);
|
||||
s5k3e2fx_i2c_write_b(s5k3e2fx_client->addr, 0x0200, 0x02);
|
||||
}
|
||||
static int s5k3e2fx_resume(struct platform_device *pdev)
|
||||
static void s5k3e2fx_resume(struct early_suspend *handler)
|
||||
{
|
||||
int rc = 0;
|
||||
struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
|
||||
struct msm_camera_sensor_info *sinfo = s5k3e2fx_pdev->dev.platform_data;
|
||||
|
||||
if (!sinfo->need_suspend)
|
||||
return 0;
|
||||
return;
|
||||
|
||||
/*check whether already suspend*/
|
||||
if (s5k3e2fx_event.waked_up == 1) {
|
||||
pr_info("S5k3e2fx: No nesesary to do Resume\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CDBG("s5k3e2fx_resume\n");
|
||||
/*init msm,clk ,GPIO,enable */
|
||||
msm_camio_probe_on(pdev);
|
||||
msm_camio_probe_on(s5k3e2fx_pdev);
|
||||
msm_camio_clk_enable(CAMIO_MDC_CLK);
|
||||
|
||||
CDBG("msm_camio_probe_on\n");
|
||||
@ -3075,14 +3079,106 @@ static int s5k3e2fx_resume(struct platform_device *pdev)
|
||||
s5k3e2fx_i2c_write_b(s5k3e2fx_client->addr, 0x3150, 0x51);
|
||||
msleep(240);
|
||||
/*set RST to low */
|
||||
msm_camio_probe_off(pdev);
|
||||
msm_camio_probe_off(s5k3e2fx_pdev);
|
||||
msm_camio_clk_disable(CAMIO_MDC_CLK);
|
||||
s5k3e2fx_event.waked_up = 1;
|
||||
wake_up(&s5k3e2fx_event.event_wait);
|
||||
CDBG("s5k3e2fx:resume done\n");
|
||||
return;
|
||||
}
|
||||
|
||||
static struct early_suspend early_suspend_s5k3e2fx = {
|
||||
.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN+1,
|
||||
.resume = s5k3e2fx_resume,
|
||||
.suspend = NULL,
|
||||
};
|
||||
|
||||
static const char *s5k3e2fxVendor = "Samsung";
|
||||
static const char *s5k3e2fxNAME = "s5k3e2fx";
|
||||
static const char *s5k3e2fxSize = "5M";
|
||||
|
||||
static ssize_t sensor_vendor_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
ssize_t ret = 0;
|
||||
|
||||
sprintf(buf, "%s %s %s\n", s5k3e2fxVendor, s5k3e2fxNAME, s5k3e2fxSize);
|
||||
ret = strlen(buf) + 1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(sensor, 0444, sensor_vendor_show, NULL);
|
||||
|
||||
static struct kobject *android_s5k3e2fx;
|
||||
|
||||
static int s5k3e2fx_sysfs_init(void)
|
||||
{
|
||||
int ret ;
|
||||
pr_info("s5k3e2fx:kobject creat and add\n");
|
||||
android_s5k3e2fx = kobject_create_and_add("android_camera", NULL);
|
||||
if (android_s5k3e2fx == NULL) {
|
||||
pr_info("s5k3e2fx_sysfs_init: subsystem_register " \
|
||||
"failed\n");
|
||||
ret = -ENOMEM;
|
||||
return ret ;
|
||||
}
|
||||
pr_info("s5k3e2fx:sysfs_create_file\n");
|
||||
ret = sysfs_create_file(android_s5k3e2fx, &dev_attr_sensor.attr);
|
||||
if (ret) {
|
||||
pr_info("s5k3e2fx_sysfs_init: sysfs_create_file " \
|
||||
"failed\n");
|
||||
kobject_del(android_s5k3e2fx);
|
||||
}
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
static int s5k3e2fx_sensor_probe(const struct msm_camera_sensor_info *info,
|
||||
struct msm_sensor_ctrl *s)
|
||||
{
|
||||
int rc = 0;
|
||||
pr_info("%s\n", __func__);
|
||||
|
||||
rc = i2c_add_driver(&s5k3e2fx_i2c_driver);
|
||||
if (rc < 0 || s5k3e2fx_client == NULL) {
|
||||
rc = -ENOTSUPP;
|
||||
goto probe_fail;
|
||||
}
|
||||
|
||||
msm_camio_clk_rate_set(S5K3E2FX_DEF_MCLK);
|
||||
msleep(20);
|
||||
|
||||
rc = s5k3e2fx_probe_init_sensor(info);
|
||||
if (rc < 0)
|
||||
goto probe_fail;
|
||||
|
||||
/* lens correction */
|
||||
s5k3e2fx_probe_init_lens_correction(info);
|
||||
init_suspend();
|
||||
|
||||
s->s_init = s5k3e2fx_sensor_open_init;
|
||||
s->s_release = s5k3e2fx_sensor_release;
|
||||
s->s_config = s5k3e2fx_sensor_config;
|
||||
|
||||
/*register late resuem*/
|
||||
register_early_suspend(&early_suspend_s5k3e2fx);
|
||||
/*init wait event*/
|
||||
init_waitqueue_head(&s5k3e2fx_event.event_wait);
|
||||
/*init waked_up value*/
|
||||
s5k3e2fx_event.waked_up = 1;
|
||||
/*write sysfs*/
|
||||
s5k3e2fx_sysfs_init();
|
||||
|
||||
return rc;
|
||||
|
||||
probe_fail:
|
||||
pr_err("SENSOR PROBE FAILS!\n");
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int __s5k3e2fx_probe(struct platform_device *pdev)
|
||||
{
|
||||
s5k3e2fx_pdev = pdev;
|
||||
return msm_camera_drv_start(pdev, s5k3e2fx_sensor_probe);
|
||||
}
|
||||
|
||||
@ -3093,7 +3189,6 @@ static struct platform_driver msm_camera_driver = {
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.suspend = s5k3e2fx_suspend,
|
||||
.resume = s5k3e2fx_resume,
|
||||
};
|
||||
|
||||
static int __init s5k3e2fx_init(void)
|
||||
|
@ -554,7 +554,12 @@ static int msm_nand_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_o
|
||||
}
|
||||
}
|
||||
|
||||
if (oob_count > 0 && ops->ooboffs != 0)
|
||||
if (!readdata && !readoob)
|
||||
{
|
||||
pr_err("%s: nothing to do\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (readoob && ops->ooboffs != 0)
|
||||
{
|
||||
pr_err("%s: unsupported ops->ooboffs, %d\n", __func__, ops->ooboffs);
|
||||
return -EINVAL;
|
||||
@ -1106,7 +1111,12 @@ msm_nand_write_oob(struct mtd_info *mtd, loff_t to, struct mtd_oob_ops *ops)
|
||||
}
|
||||
}
|
||||
|
||||
if (oob_count != 0 && ops->ooboffs != 0)
|
||||
if (!writedata && !writeoob)
|
||||
{
|
||||
pr_err("%s: nothing to do\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (writeoob && ops->ooboffs != 0)
|
||||
{
|
||||
pr_err("%s: unsupported ops->ooboffs, %d\n", __func__, ops->ooboffs);
|
||||
return -EINVAL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user