aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-s3c2442/mach-gta02.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-s3c2442/mach-gta02.c')
-rw-r--r--arch/arm/mach-s3c2442/mach-gta02.c121
1 files changed, 59 insertions, 62 deletions
diff --git a/arch/arm/mach-s3c2442/mach-gta02.c b/arch/arm/mach-s3c2442/mach-gta02.c
index 6aff6f02750..d367b6f7e5d 100644
--- a/arch/arm/mach-s3c2442/mach-gta02.c
+++ b/arch/arm/mach-s3c2442/mach-gta02.c
@@ -50,7 +50,6 @@
#include <linux/io.h>
#include <linux/i2c.h>
-#include <linux/backlight.h>
#include <linux/regulator/machine.h>
#include <linux/mfd/pcf50633/core.h>
@@ -58,6 +57,7 @@
#include <linux/mfd/pcf50633/adc.h>
#include <linux/mfd/pcf50633/gpio.h>
#include <linux/mfd/pcf50633/pmic.h>
+#include <linux/mfd/pcf50633/backlight.h>
#include <linux/input.h>
#include <linux/gpio_keys.h>
@@ -108,6 +108,15 @@
#include <linux/gta02-vibrator.h>
+#include <mach/ts.h>
+#include <linux/input/touchscreen/ts_filter_chain.h>
+#ifdef CONFIG_TOUCHSCREEN_FILTER
+#include <linux/input/touchscreen/ts_filter_linear.h>
+#include <linux/input/touchscreen/ts_filter_mean.h>
+#include <linux/input/touchscreen/ts_filter_median.h>
+#include <linux/input/touchscreen/ts_filter_group.h>
+#endif
+
struct pcf50633 *gta02_pcf;
/*
@@ -459,6 +468,12 @@ static struct regulator_consumer_supply ldo6_consumers[] = {
};
#endif
+static struct pcf50633_bl_platform_data gta02_backlight_data = {
+ .default_brightness = 0x3f,
+ .default_brightness_limit = 0,
+ .ramp_time = 3,
+};
+
struct pcf50633_platform_data gta02_pcf_pdata = {
.resumers = {
[0] = PCF50633_INT1_USBINS |
@@ -476,6 +491,8 @@ struct pcf50633_platform_data gta02_pcf_pdata = {
.chg_ref_current_ma = 1000,
+ .backlight_data = &gta02_backlight_data,
+
.reg_init_data = {
[PCF50633_REGULATOR_AUTO] = {
.constraints = {
@@ -692,67 +709,52 @@ static struct s3c2410_udc_mach_info gta02_udc_cfg = {
};
-static void gta02_bl_set_intensity(int intensity)
-{
- struct pcf50633 *pcf = gta02_pcf;
- int old_intensity = pcf50633_reg_read(pcf, PCF50633_REG_LEDOUT);
-
- /* We map 8-bit intensity to 6-bit intensity in hardware. */
- intensity >>= 2;
-
- /*
- * This can happen during, eg, print of panic on blanked console,
- * but we can't service i2c without interrupts active, so abort.
- */
- if (in_atomic()) {
- printk(KERN_ERR "gta02_bl_set_intensity called while atomic\n");
- return;
- }
-
- old_intensity = pcf50633_reg_read(pcf, PCF50633_REG_LEDOUT);
- if (intensity == old_intensity)
- return;
-
- /* We can't do this anywhere else. */
- pcf50633_reg_write(pcf, PCF50633_REG_LEDDIM, 5);
+/* Touchscreen configuration. */
- if (!(pcf50633_reg_read(pcf, PCF50633_REG_LEDENA) & 3))
- old_intensity = 0;
-
- /*
- * The PCF50633 cannot handle LEDOUT = 0 (datasheet p60)
- * if seen, you have to re-enable the LED unit.
- */
- if (!intensity || !old_intensity)
- pcf50633_reg_write(pcf, PCF50633_REG_LEDENA, 0);
+#ifdef CONFIG_TOUCHSCREEN_FILTER
+const static struct ts_filter_group_configuration gta02_ts_group = {
+ .length = 12,
+ .close_enough = 10,
+ .threshold = 6, /* At least half of the points in a group. */
+ .attempts = 10,
+};
- /* Illegal to set LEDOUT to 0. */
- if (!intensity)
- pcf50633_reg_set_bit_mask(pcf, PCF50633_REG_LEDOUT, 0x3f, 2);
- else
- pcf50633_reg_set_bit_mask(pcf, PCF50633_REG_LEDOUT, 0x3f,
- intensity);
+const static struct ts_filter_median_configuration gta02_ts_median = {
+ .extent = 20,
+ .decimation_below = 3,
+ .decimation_threshold = 8 * 3,
+ .decimation_above = 4,
+};
- if (intensity)
- pcf50633_reg_write(pcf, PCF50633_REG_LEDENA, 2);
+const static struct ts_filter_mean_configuration gta02_ts_mean = {
+ .length = 4,
+};
-}
+const static struct ts_filter_linear_configuration gta02_ts_linear = {
+ .constants = {1, 0, 0, 0, 1, 0, 1}, /* Don't modify coords. */
+ .coord0 = 0,
+ .coord1 = 1,
+};
+#endif
-static struct generic_bl_info gta02_bl_info = {
- .name = "gta02-bl",
- .max_intensity = 0xff,
- .default_intensity = 0xff,
- .set_bl_intensity = gta02_bl_set_intensity,
+const static struct ts_filter_chain_configuration gta02_filter_configuration[] =
+{
+#ifdef CONFIG_TOUCHSCREEN_FILTER
+ {&ts_filter_group_api, &gta02_ts_group.config},
+ {&ts_filter_median_api, &gta02_ts_median.config},
+ {&ts_filter_mean_api, &gta02_ts_mean.config},
+ {&ts_filter_linear_api, &gta02_ts_linear.config},
+#endif
+ {NULL, NULL},
};
-static struct platform_device gta02_bl_dev = {
- .name = "generic-bl",
- .id = 1,
- .dev = {
- .platform_data = &gta02_bl_info,
- },
+const static struct s3c2410_ts_mach_info gta02_ts_cfg = {
+ .delay = 10000,
+ .presc = 0xff, /* slow as we can go */
+ .filter_config = gta02_filter_configuration,
};
+
/* USB */
static struct s3c2410_hcd_info gta02_usb_info = {
.port[0] = {
@@ -826,15 +828,7 @@ static struct platform_device gta02_leds_device = {
/* JBT6k74 display controller */
static void gta02_jbt6k74_probe_completed(struct device *dev)
{
- struct pcf50633 *pcf = gta02_pcf;
- /* Switch on backlight. Qi does not do it for us */
- pcf50633_reg_write(pcf, PCF50633_REG_LEDOUT, 0x01);
- pcf50633_reg_write(pcf, PCF50633_REG_LEDENA, 0x00);
- pcf50633_reg_write(pcf, PCF50633_REG_LEDDIM, 0x01);
- pcf50633_reg_write(pcf, PCF50633_REG_LEDENA, 0x01);
-
- gta02_bl_dev.dev.parent = dev;
- platform_device_register(&gta02_bl_dev);
+ pcf50633_bl_set_brightness_limit(gta02_pcf, 0x3f);
}
const struct jbt6k74_platform_data jbt6k74_pdata = {
@@ -982,11 +976,13 @@ static struct platform_device *gta02_devices[] __initdata = {
&gta02_pm_bt_dev,
&gta02_pm_gsm_dev,
&gta02_pm_wlan_dev,
+ &s3c_device_adc,
};
/* These guys DO need to be children of PMU. */
static struct platform_device *gta02_devices_pmu_children[] = {
+ &s3c_device_ts,
&gta02_glamo_dev,
&gta02_hdq_device,
&gta02_vibrator_device,
@@ -1124,6 +1120,7 @@ static void __init gta02_machine_init(void)
s3c24xx_udc_set_platdata(&gta02_udc_cfg);
s3c_i2c0_set_platdata(NULL);
+ set_s3c2410ts_info(&gta02_ts_cfg);
i2c_register_board_info(0, gta02_i2c_devs, ARRAY_SIZE(gta02_i2c_devs));
spi_register_board_info(gta02_spi_board_info,