Tweaked overclock code and Merge branch 'master' of git://gitorious.org/linux-on-wince-htc/linux_on_wince_htc

Conflicts:
	arch/arm/mach-msm/board-htcleo-battery.c
This commit is contained in:
Jon Benson 2010-10-26 18:48:47 +11:00
commit 8b9490b745
7 changed files with 670 additions and 742 deletions

View File

@ -1650,16 +1650,20 @@ CONFIG_MISC_FILESYSTEMS=y
# CONFIG_BEFS_FS is not set
# CONFIG_BFS_FS is not set
# CONFIG_EFS_FS is not set
CONFIG_YAFFS_FS=y
CONFIG_YAFFS_FS=m
CONFIG_YAFFS_YAFFS1=y
# CONFIG_YAFFS_9BYTE_TAGS is not set
# CONFIG_YAFFS_DOES_ECC is not set
CONFIG_YAFFS_YAFFS2=y
CONFIG_YAFFS_AUTO_YAFFS2=y
# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set
CONFIG_YAFFS_DISABLE_TAGS_ECC=y
# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set
# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
# CONFIG_YAFFS_EMPTY_LOST_AND_FOUND is not set
CONFIG_YAFFS_DISABLE_BLOCK_REFRESHING=y
# CONFIG_YAFFS_DISABLE_BACKGROUND is not set
CONFIG_YAFFS_XATTR=y
# CONFIG_JFFS2_FS is not set
# CONFIG_CRAMFS is not set
CONFIG_SQUASHFS=y

View File

@ -171,25 +171,28 @@ struct clkctl_acpu_speed acpu_freq_tbl[] = {
{ 1075200, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x1C, 0, 1250, 128000 },
{ 1113600, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x1D, 0, 1275, 128000 },
{ 1152000, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x1E, 0, 1300, 128000 },
{ 1190400, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x1F, 0, 1325, 128000 },
#elif CONFIG_HTCLEO_UNDERVOLT_925
{ 1036800, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x1B, 0, 1225, 128000 },
{ 1075200, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x1C, 0, 1250, 128000 },
{ 1113600, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x1D, 0, 1275, 128000 },
{ 1152000, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x1E, 0, 1300, 128000 },
{ 1190400, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x1F, 0, 1325, 128000 },
#elif CONFIG_HTCLEO_UNDERVOLT_800
{ 1036800, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x1B, 0, 1225, 128000 },
{ 1075200, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x1C, 0, 1250, 128000 },
{ 1113600, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x1D, 0, 1275, 128000 },
{ 1152000, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x1E, 0, 1300, 128000 },
{ 1190400, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x1F, 0, 1325, 128000 },
#else
{ 1036800, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x1B, 0, 1300, 128000 },
{ 1075200, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x1C, 0, 1300, 128000 },
{ 1113600, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x1D, 0, 1300, 128000 },
{ 1152000, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x1E, 0, 1325, 128000 },
{ 1190400, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x1F, 0, 1325, 128000 },
#endif
#endif
#ifdef CONFIG_HTCLEO_EXOVERCLOCK
{ 1190400, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x1F, 0, 1325, 128000 },
{ 1228800, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x20, 0, 1325, 128000 },
{ 1267200, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x21, 0, 1350, 128000 },
{ 1305600, CCTL(CLK_TCXO, 1), SRC_SCPLL, 0x22, 0, 1350, 128000 },

File diff suppressed because it is too large Load Diff

View File

@ -37,12 +37,13 @@
#include <linux/delay.h>
#include <linux/gpio.h>
#include <linux/switch.h>
#include <mach/board-htcleo-battery.h>
#include "board-htcleo.h"
static char *supply_list[] =
{
"battery",
"battery",
};
static int inited;
@ -51,7 +52,7 @@ static int usb_status;
static struct work_struct vbus_work;
#ifdef CONFIG_USB_ANDROID
extern void notify_usb_connected(int status);
void notify_usb_connected(int status);
static struct t_usb_status_notifier usb_status_notifier = {
.name = "htc_battery",
.func = notify_usb_connected,
@ -62,122 +63,126 @@ static int power_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{
if (psp != POWER_SUPPLY_PROP_ONLINE)
return -EINVAL;
if (psp != POWER_SUPPLY_PROP_ONLINE)
return -EINVAL;
if (psy->type == POWER_SUPPLY_TYPE_MAINS)
{
val->intval = (usb_status == 2);
}
else
{
val->intval = vbus_present;
}
return 0;
if (psy->type == POWER_SUPPLY_TYPE_MAINS)
{
val->intval = (usb_status == 2);
}
else
{
val->intval = vbus_present;
}
return 0;
}
static enum power_supply_property power_properties[] =
{
POWER_SUPPLY_PROP_ONLINE,
POWER_SUPPLY_PROP_ONLINE,
};
static struct power_supply ac_supply =
{
.name = "ac",
.type = POWER_SUPPLY_TYPE_MAINS,
.supplied_to = supply_list,
.num_supplicants = ARRAY_SIZE(supply_list),
.properties = power_properties,
.num_properties = ARRAY_SIZE(power_properties),
.get_property = power_get_property,
.name = "ac",
.type = POWER_SUPPLY_TYPE_MAINS,
.supplied_to = supply_list,
.num_supplicants = ARRAY_SIZE(supply_list),
.properties = power_properties,
.num_properties = ARRAY_SIZE(power_properties),
.get_property = power_get_property,
};
static struct power_supply usb_supply =
{
.name = "usb",
.type = POWER_SUPPLY_TYPE_USB,
.supplied_to = supply_list,
.num_supplicants = ARRAY_SIZE(supply_list),
.properties = power_properties,
.num_properties = ARRAY_SIZE(power_properties),
.get_property = power_get_property,
.name = "usb",
.type = POWER_SUPPLY_TYPE_USB,
.supplied_to = supply_list,
.num_supplicants = ARRAY_SIZE(supply_list),
.properties = power_properties,
.num_properties = ARRAY_SIZE(power_properties),
.get_property = power_get_property,
};
static int get_vbus_state(void)
{
if (readl(MSM_SHARED_RAM_BASE + 0xEF20C))
return 1;
else
return 0;
if (readl(MSM_SHARED_RAM_BASE + 0xEF20C))
return 1;
else
return 0;
}
void notify_cable_status(int status)
{
pr_info("### notify_cable_status(%d) ###\n", status);
vbus_present = status;
msm_hsusb_set_vbus_state(vbus_present);
power_supply_changed(&ac_supply);
power_supply_changed(&usb_supply);
pr_info("### notify_cable_status(%d) ###\n", status);
vbus_present = status;
msm_hsusb_set_vbus_state(vbus_present);
power_supply_changed(&ac_supply);
power_supply_changed(&usb_supply);
if(mydi)
power_supply_changed(&mydi->bat);
}
// called from USB driver
void notify_usb_connected(int status)
{
if (!inited) return;
pr_info("### notify_usb_connected(%d) ###\n", status);
usb_status = status;
power_supply_changed(&ac_supply);
power_supply_changed(&usb_supply);
if (!inited) return;
pr_info("### notify_usb_connected(%d) ###\n", status);
usb_status = status;
power_supply_changed(&ac_supply);
power_supply_changed(&usb_supply);
if(mydi)
power_supply_changed(&mydi->bat);
}
// called from DEX intrrupt
void notify_vbus_change_intr(void)
{
if (!inited) return;
schedule_work(&vbus_work);
if (!inited) return;
schedule_work(&vbus_work);
}
// used by battery driver
int is_ac_power_supplied(void)
{
return (usb_status == 2);
return (usb_status == 2);
}
static void vbus_work_func(struct work_struct *work)
{
int vbus = get_vbus_state();
printk(" new vbus = %d\n", vbus);
#ifdef CONFIG_USB_EHCI_HCD
if (vbus)
return 0;
else
return 0;
#else
if (vbus)
gpio_set_value(HTCLEO_GPIO_POWER_USB, 0);
else
gpio_set_value(HTCLEO_GPIO_POWER_USB, 1);
#endif
notify_cable_status(vbus);
int vbus = get_vbus_state();
printk(" new vbus = %d\n", vbus);
#ifdef CONFIG_USB_EHCI_HCD
if (vbus)
return 0;
else
return 0;
#else
if (vbus)
gpio_set_value(HTCLEO_GPIO_POWER_USB, 0);
else
gpio_set_value(HTCLEO_GPIO_POWER_USB, 1);
#endif
notify_cable_status(vbus);
}
static int htcleo_power_probe(struct platform_device *pdev)
{
printk("$$$ htcleo_power_probe $$$\n");
printk("$$$ htcleo_power_probe $$$\n");
INIT_WORK(&vbus_work, vbus_work_func);
INIT_WORK(&vbus_work, vbus_work_func);
gpio_request(HTCLEO_GPIO_POWER_USB, "power_usb");
gpio_direction_output(HTCLEO_GPIO_POWER_USB, 0);
gpio_request(HTCLEO_GPIO_POWER_USB, "power_usb");
gpio_direction_output(HTCLEO_GPIO_POWER_USB, 0);
power_supply_register(&pdev->dev, &ac_supply);
power_supply_register(&pdev->dev, &usb_supply);
power_supply_register(&pdev->dev, &ac_supply);
power_supply_register(&pdev->dev, &usb_supply);
inited = 1;
// init VBUS state
notify_vbus_change_intr();
return 0;
inited = 1;
// init VBUS state
notify_vbus_change_intr();
return 0;
}
//#define APP_BATT_PDEV_NAME "rs30100001:00000000"
@ -185,25 +190,25 @@ static int htcleo_power_probe(struct platform_device *pdev)
static struct platform_driver htcleo_power_driver =
{
.probe = htcleo_power_probe,
.driver =
{
.name = APP_BATT_PDEV_NAME,
.owner = THIS_MODULE,
},
.probe = htcleo_power_probe,
.driver =
{
.name = APP_BATT_PDEV_NAME,
.owner = THIS_MODULE,
},
};
static int __init htcleo_power_init(void)
{
printk("htcleo_power_init\n");
platform_driver_register(&htcleo_power_driver);
#ifdef CONFIG_USB_ANDROID
usb_register_notifier(&usb_status_notifier);
#endif
return 0;
printk("htcleo_power_init\n");
platform_driver_register(&htcleo_power_driver);
#ifdef CONFIG_USB_ANDROID
usb_register_notifier(&usb_status_notifier);
#endif
return 0;
}
module_init(htcleo_power_init);
//later_init(htcleo_power_init);
//module_init(htcleo_power_init);
late_initcall(htcleo_power_init);
MODULE_DESCRIPTION("HTCLEO Power Driver");
MODULE_LICENSE("GPL");

View File

@ -0,0 +1,102 @@
#ifndef __LEO_BATTERY__
#define __LEO_BATTERY__
#include <linux/android_alarm.h>
#define LEO_BATTERY_CAPACITY 1230
#define LEO_BATTERY_EMPTY 500
// from board-htcleo-power.c
extern int is_ac_power_supplied(void);
// from board-htcleo-log.c
extern double log(double x);
#define RAW_DATA_SIZE 10
struct battery_status
{
int timestamp;
int voltage_uV; /* units of uV */
int current_uA; /* units of uA */
int current_avg_uA;
int charge_uAh;
s16 temp_C; /* units of 0.1 C */
u8 percentage; /* battery percentage */
u8 charge_source;
u8 status_reg;
u8 battery_full; /* battery full (don't charge) */
u8 cooldown; /* was overtemp */
u8 charge_mode;
} __attribute__((packed));
#define SOURCE_NONE 0
#define SOURCE_USB 1
#define SOURCE_AC 2
#define CHARGE_OFF 0
#define CHARGE_SLOW 1
#define CHARGE_FAST 2
#define TEMP_CRITICAL 600 /* no charging at all */
#define TEMP_HOT 500 /* no fast charge, no charge > 4.1v */
#define TEMP_WARM 450 /* no fast charge above this */
#define TEMP_HOT_MAX_MV 4100 /* stop charging here when hot */
#define TEMP_HOT_MIN_MV 3800 /* resume charging here when hot */
#define CE_DISABLE_MIN_MV 4100
/* When we're awake or running on wall power, sample the battery
* gauge every FAST_POLL seconds. If we're asleep and on battery
* power, sample every SLOW_POLL seconds
*/
#define FAST_POLL (1 * 60)
#define SLOW_POLL (10 * 60)
struct htcleo_device_info
{
struct device *dev;
/* DS2784 data, valid after calling htcleo_battery_read_status() */
char raw[RAW_DATA_SIZE]; /* raw HTCLEO data */
uint32_t raw_status;
struct battery_status status;
struct power_supply bat;
struct workqueue_struct *monitor_wqueue;
struct work_struct monitor_work;
struct alarm alarm;
struct wake_lock work_wake_lock;
// int (*charge)(int on, int fast);
// struct w1_slave *w1_slave;
struct i2c_client *client;
u8 dummy; /* dummy battery flag */
u8 last_charge_mode; /* previous charger state */
u8 slow_poll;
ktime_t last_poll;
ktime_t last_charge_seen;
};
static struct htcleo_device_info * mydi = NULL;
#define psy_to_dev_info(x) container_of((x), struct htcleo_device_info, bat)
static struct wake_lock vbus_wake_lock;
#define to_htcleo_device_info(x) container_of((x), struct htcleo_device_info, bat);
#endif

View File

@ -173,6 +173,7 @@ static char acdb_file[64] = "default.acdb";
static uint32_t tx_acdb = 0;
static uint32_t rx_acdb = 0;
static int acdb_use_rpc = 0;
static int acdb_use_map = 0;
/////////////////////////////////////////////////////////////////////////////////
// helper functions for device parameters
@ -1152,11 +1153,27 @@ static int acdb_init(char *filename)
// return -ENODEV;
#ifdef CONFIG_MACH_HTCLEO
pr_info("acdb: trying htcleo.acdb\n");
if(request_firmware(&fw, "htcleo.acdb", q6_control_device.this_device) < 0) {
pr_info("acdb: load 'htcleo.acdb' failed, trying 'default.acdb'\n");
acdb_use_map = 0;
if (request_firmware(&fw, filename, q6_control_device.this_device) < 0) {
pr_err("acdb: load 'default.acdb' failed...\n");
return -ENODEV;
}
} else {
pr_info("acdb: 'htcleo.acdb' found, using translation\n");
acdb_use_map = 1;
}
#else
pr_info("acdb: load '%s'\n", filename);
acd_use_map = 0;
if (request_firmware(&fw, filename, q6_control_device.this_device) < 0) {
pr_err("acdb: load 'default.acdb' failed...\n");
return -ENODEV;
}
#endif
db = (void*) fw->data;
if (fw->size < sizeof(struct audio_config_database)) {
@ -1364,9 +1381,12 @@ static int acdb_get_config_table(uint32_t device_id, uint32_t sample_rate)
int n;
printk("table\n");
// htcleo use custom table with wince values, it must be mapped
if(acdb_use_map)
device_id = map_cad_dev_to_virtual(device_id);
db = acdb_data;
for (n = 0; n < db->entry_count; n++)
{
{
if (db->entry[n].device_id != device_id)
continue;
if (db->entry[n].sample_rate != sample_rate)

View File

@ -1170,8 +1170,8 @@ int write_one_page(struct page *page, int wait);
void task_dirty_inc(struct task_struct *tsk);
/* readahead.c */
#define VM_MAX_READAHEAD 4 /* kbytes */
#define VM_MIN_READAHEAD 4 /* kbytes (includes current page) */
#define VM_MAX_READAHEAD 128 /* kbytes */
#define VM_MIN_READAHEAD 16 /* kbytes (includes current page) */
int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
pgoff_t offset, unsigned long nr_to_read);