Merge branch 'master' of git://gitorious.org/linux-on-wince-htc/linux_on_wince_htc
This commit is contained in:
commit
e1b186e332
@ -85,7 +85,7 @@ static ssize_t htcleo_auto_bl_set(struct device *dev,
|
||||
}
|
||||
|
||||
|
||||
static DEVICE_ATTR(auto_bl, 0644, htcleo_auto_bl_get, htcleo_auto_bl_set);
|
||||
static DEVICE_ATTR(auto_bl, 0666, htcleo_auto_bl_get, htcleo_auto_bl_set);
|
||||
|
||||
static int htcleo_brightness_onoff_bkl(int enable)
|
||||
{
|
||||
@ -131,14 +131,14 @@ static void htcleo_brightness_set(struct led_classdev *led_cdev, enum led_bright
|
||||
LCMDBG("htcleo_brightness_set: %d\n", val);
|
||||
if (val > 255) val = 255;
|
||||
led_cdev->brightness = val;
|
||||
if (val < 30)
|
||||
if (val < 1)
|
||||
{
|
||||
htcleo_brightness_onoff_bkl(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
htcleo_brightness_onoff_bkl(1);
|
||||
htcleo_brightness_set_bkl((val - 30) / 23);
|
||||
htcleo_brightness_set_bkl((val - 1) / 23);
|
||||
}
|
||||
mutex_unlock(&htcleo_backlight_lock);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ user may be able to adjust time in future
|
||||
//#define LSENSOR_ABLK_ONLY 2
|
||||
|
||||
|
||||
#define LSENSOR_POLL_PROMESHUTOK 1000
|
||||
#define LSENSOR_POLL_PROMESHUTOK 5000
|
||||
|
||||
#define D(x...) pr_debug(x)
|
||||
// pr_info(x)
|
||||
|
@ -544,6 +544,12 @@ void dma_cache_maint(const void *start, size_t size, int direction)
|
||||
void (*inner_op)(const void *, const void *);
|
||||
void (*outer_op)(unsigned long, unsigned long);
|
||||
|
||||
if (!virt_addr_valid(start) || !virt_addr_valid(start + size - 1))
|
||||
{
|
||||
printk(KERN_ERR "%s: %08x not a valid virt address, PAGE_OFFSET=%08x, high_memory=%08x\n",
|
||||
__func__, (uint32_t)start,(uint32_t)PAGE_OFFSET, (uint32_t)high_memory );
|
||||
}
|
||||
|
||||
BUG_ON(!virt_addr_valid(start) || !virt_addr_valid(start + size - 1));
|
||||
|
||||
switch (direction) {
|
||||
|
@ -497,6 +497,7 @@ static int msm_nand_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_o
|
||||
unsigned page_oob_done;
|
||||
uint32_t oob_count=0;
|
||||
uint32_t oob_done_size=0;
|
||||
uint32_t data_count=0; //number of bytes mapped into dma
|
||||
int readdata=0;
|
||||
int readoob=0;
|
||||
uint32_t readcmd;
|
||||
@ -620,6 +621,7 @@ static int msm_nand_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_o
|
||||
{
|
||||
/* memset(ops->datbuf, 0x55, ops->len); */
|
||||
data_dma_addr_curr = data_dma_addr = msm_nand_dma_map(chip->dev, ops->datbuf, ops->len, DMA_FROM_DEVICE);
|
||||
data_count = ops->len; //initially map whole buf to dma
|
||||
if (dma_mapping_error(chip->dev, data_dma_addr))
|
||||
{
|
||||
pr_err("msm_nand_read_oob: failed to get dma addr for %p\n", ops->datbuf);
|
||||
@ -821,11 +823,14 @@ static int msm_nand_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_o
|
||||
if (readdata)
|
||||
{
|
||||
uint8_t *datbuf = ops->datbuf + pages_read * mtd->writesize;
|
||||
|
||||
dma_sync_single_for_cpu(chip->dev,
|
||||
data_dma_addr_curr-mtd->writesize,
|
||||
mtd->writesize, DMA_BIDIRECTIONAL);
|
||||
|
||||
uint32_t data_done = data_dma_addr_curr-data_dma_addr;
|
||||
#if VERBOSE
|
||||
printk("msm_nand_read_oob dma_unmap_page %08x\n", (uint32_t)data_dma_addr_curr);
|
||||
#endif
|
||||
dma_unmap_page(chip->dev, data_dma_addr, data_count, DMA_FROM_DEVICE);
|
||||
data_count -= data_done; // we wont be mapping the already transferred bytes to avoid corruption
|
||||
//data now ready to be read by cpu
|
||||
|
||||
for (n = 0; n < mtd->writesize; n++)
|
||||
{
|
||||
if ((n % 512) == 0xF3 && datbuf[n] == 0x76)
|
||||
@ -842,13 +847,26 @@ static int msm_nand_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_o
|
||||
}
|
||||
}
|
||||
|
||||
dma_sync_single_for_device(chip->dev,
|
||||
data_dma_addr_curr-mtd->writesize,
|
||||
mtd->writesize, DMA_BIDIRECTIONAL);
|
||||
|
||||
//remap dma if there's still data to be read
|
||||
if (data_count > 0)
|
||||
{
|
||||
#if VERBOSE
|
||||
printk("msm_nand_read_oob dma_map_page offset=%d length=%d\n", (uint32_t)(ops->len-data_count), data_count);
|
||||
#endif
|
||||
data_dma_addr = msm_nand_dma_map(chip->dev, ops->datbuf+(ops->len-data_count), data_count, DMA_FROM_DEVICE);
|
||||
data_dma_addr_curr = data_dma_addr;
|
||||
#if VERBOSE
|
||||
printk("msm_nand_read_oob dma_map_page returned %08x\n", (uint32_t)data_dma_addr);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
data_dma_addr_curr = data_dma_addr = 0;
|
||||
}
|
||||
}
|
||||
if (readoob && oob_done_size < oob_count)
|
||||
{
|
||||
//no sync needed for BIDIR dma buffers
|
||||
uint8_t *pageoobbuf = ops->oobbuf + oob_done_size;
|
||||
|
||||
for (n = 0; n < page_oob_done; n++)
|
||||
@ -909,7 +927,7 @@ static int msm_nand_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_o
|
||||
}
|
||||
else
|
||||
{
|
||||
pr_info("error status: %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x \n",
|
||||
pr_info("msm_nand_read_oob error status: %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x \n",
|
||||
dma_buffer->data.result[0].flash_status,
|
||||
dma_buffer->data.result[0].buffer_status,
|
||||
dma_buffer->data.result[1].flash_status,
|
||||
@ -950,9 +968,9 @@ static int msm_nand_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_o
|
||||
msm_nand_release_dma_buffer(chip, dma_buffer, sizeof(*dma_buffer));
|
||||
|
||||
if (readoob)
|
||||
dma_unmap_page(chip->dev, oob_dma_addr, oob_count, DMA_FROM_DEVICE);
|
||||
dma_unmap_page(chip->dev, oob_dma_addr, oob_count, DMA_BIDIRECTIONAL);
|
||||
err_dma_map_oobbuf_failed:
|
||||
if (readdata)
|
||||
if (readdata && data_dma_addr != 0)
|
||||
dma_unmap_page(chip->dev, data_dma_addr, ops->len, DMA_FROM_DEVICE);
|
||||
|
||||
#ifdef ENABLE_FLASH_RW_DUMP
|
||||
|
@ -580,7 +580,9 @@ static void __update_capacity(void)
|
||||
{
|
||||
INT32 next_capacity_01p;
|
||||
|
||||
#if HTC_BATTERY_DS2746_DEBUG_ENABLE
|
||||
pr_info("ds2746_batt:__update_capacity start\n");
|
||||
#endif
|
||||
if (poweralg.charge_state == CHARGE_STATE_PREDICTION ||
|
||||
poweralg.charge_state == CHARGE_STATE_UNKNOWN){
|
||||
|
||||
@ -789,6 +791,7 @@ BOOL do_power_alg(BOOL is_event_triggered)
|
||||
/*powerlog_to_file(&poweralg);
|
||||
update_os_batt_status(&poweralg);*/
|
||||
|
||||
#if HTC_BATTERY_DS2746_DEBUG_ENABLE
|
||||
printk(DRIVER_ZONE "[%d] P=%d cable=%d%d flags=%d%d%d debug=%d%d%d%d fst_discharge=%d/%d [%u]\n",
|
||||
poweralg.charge_state,
|
||||
poweralg.capacity_01p,
|
||||
@ -804,6 +807,7 @@ BOOL do_power_alg(BOOL is_event_triggered)
|
||||
poweralg.fst_discharge_capacity_01p,
|
||||
poweralg.fst_discharge_acr_mAh,
|
||||
BAHW_MyGetMSecs());
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -881,7 +885,9 @@ void power_alg_preinit(void)
|
||||
static BLOCKING_NOTIFIER_HEAD(ds2746_notifier_list);
|
||||
int ds2746_register_notifier(struct notifier_block *nb)
|
||||
{
|
||||
#if HTC_BATTERY_DS2746_DEBUG_ENABLE
|
||||
pr_info("%s\n", __func__);
|
||||
#endif
|
||||
return blocking_notifier_chain_register(&ds2746_notifier_list, nb);
|
||||
}
|
||||
|
||||
@ -894,7 +900,9 @@ int ds2746_unregister_notifier(struct notifier_block *nb)
|
||||
int ds2746_blocking_notify(unsigned long val, void *v)
|
||||
{
|
||||
int chg_ctl;
|
||||
#if HTC_BATTERY_DS2746_DEBUG_ENABLE
|
||||
pr_info("%s\n", __func__);
|
||||
#endif
|
||||
|
||||
if (val == DS2784_CHARGING_CONTROL){
|
||||
chg_ctl = *(int *) v;
|
||||
@ -1044,17 +1052,23 @@ void ds2746_charger_control(int type)
|
||||
else if (htc_batt_info.rep.battery_full)
|
||||
pr_info("batt: charging OFF [FULL]\n");
|
||||
else*/
|
||||
#if HTC_BATTERY_DS2746_DEBUG_ENABLE
|
||||
pr_info("batt: charging OFF\n");
|
||||
#endif
|
||||
break;
|
||||
case CHARGE_SLOW:
|
||||
chg_ctl = ENABLE_SLOW_CHG;
|
||||
ds2746_blocking_notify(DS2784_CHARGING_CONTROL, &chg_ctl);
|
||||
#if HTC_BATTERY_DS2746_DEBUG_ENABLE
|
||||
pr_info("batt: charging SLOW\n");
|
||||
#endif
|
||||
break;
|
||||
case CHARGE_FAST:
|
||||
chg_ctl = ENABLE_FAST_CHG;
|
||||
ds2746_blocking_notify(DS2784_CHARGING_CONTROL, &chg_ctl);
|
||||
#if HTC_BATTERY_DS2746_DEBUG_ENABLE
|
||||
pr_info("batt: charging FAST\n");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1077,7 +1091,9 @@ static void ds2746_battery_work(struct work_struct *work)
|
||||
struct ds2746_device_info, monitor_work);
|
||||
unsigned long flags;
|
||||
|
||||
#if HTC_BATTERY_DS2746_DEBUG_ENABLE
|
||||
pr_info("[ds2746_batt] ds2746_battery_work*\n");
|
||||
#endif
|
||||
do_power_alg(0);
|
||||
get_state_check_interval_min_sec();
|
||||
di->last_poll = alarm_get_elapsed_realtime();
|
||||
|
@ -507,6 +507,7 @@ static BOOL __ds2746_battery_adc_udpate(struct battery_type *battery)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if HTC_ENABLE_POWER_DEBUG
|
||||
printk(DRIVER_ZONE " [x0]%x [x8]%x %x %x %x %x %x %x %x %x %x\n",
|
||||
reg[0],
|
||||
reg[2],
|
||||
@ -519,6 +520,7 @@ static BOOL __ds2746_battery_adc_udpate(struct battery_type *battery)
|
||||
reg[9],
|
||||
reg[10],
|
||||
reg[11]);
|
||||
#endif
|
||||
|
||||
if (!(reg[0] & DS2746_STATUS_AIN0) || !(reg[0] & DS2746_STATUS_AIN1)) {
|
||||
printk(DRIVER_ZONE " AIN not ready...\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user