summaryrefslogtreecommitdiffstats
path: root/firmware/drivers
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2016-05-02 22:01:22 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2016-06-01 23:08:17 +0200
commitb2afd931e2d83ce346811a68a34ee56c48be6d35 (patch)
tree58a32e570889406d0805d70054b97c99b257c8e8 /firmware/drivers
parent4d42e3685c55a6de9d05003f8482f7fb1be022fd (diff)
downloadrockbox-b2afd931e2d83ce346811a68a34ee56c48be6d35.tar.gz
rockbox-b2afd931e2d83ce346811a68a34ee56c48be6d35.tar.bz2
rockbox-b2afd931e2d83ce346811a68a34ee56c48be6d35.zip
fuze+: rewrite touchpad driver
The old driver was bad in many respect, it had some race conditions, it was using a thread to serialize transfers because of the legacy i2c interface. It also had huge latency (typically 50ms but delays up to 300ms can happen), thus some presses were missed. The new driver takes advantage of the new i2c driver to do everything asynchronously. It also does not need a thread anymore because queueing ensures proper serialization. It provides much better and reliable latency (typically ~2ms). Also fix the debug screen which was horribly broken. The new screen also displays the deadzones. Change-Id: I69b7f99b75053e6b1d3d56beb4453c004fd2076e
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/synaptics-rmi.c104
1 files changed, 0 insertions, 104 deletions
diff --git a/firmware/drivers/synaptics-rmi.c b/firmware/drivers/synaptics-rmi.c
deleted file mode 100644
index 1b7cf2f8ef..0000000000
--- a/firmware/drivers/synaptics-rmi.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2011 by Amaury Pouly
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-#include "system.h"
-#include "synaptics-rmi.h"
-#include "i2c.h"
-
-static int rmi_cur_page;
-static int rmi_i2c_addr;
-
-static unsigned char dev_ctl_reg;
-
-/* NOTE:
- * RMI over i2c supports some special aliases on page 0x2 but this driver don't
- * use them */
-
-int rmi_init(int i2c_dev_addr)
-{
- rmi_i2c_addr = i2c_dev_addr;
- rmi_cur_page = 0x4;
- dev_ctl_reg = rmi_read_single(RMI_DEVICE_CONTROL);
- return 0;
-}
-
-static int rmi_select_page(unsigned char page)
-{
- /* Lazy page select */
- if(page != rmi_cur_page)
- {
- rmi_cur_page = page;
- return i2c_writemem(rmi_i2c_addr, RMI_PAGE_SELECT, &page, 1);
- }
- else
- return 0;
-}
-
-int rmi_read(int address, int byte_count, unsigned char *buffer)
-{
- int ret;
- if((ret = rmi_select_page(address >> 8)) < 0)
- return ret;
- return i2c_readmem(rmi_i2c_addr, address & 0xff, buffer, byte_count);
-}
-
-int rmi_read_single(int address)
-{
- unsigned char c;
- int ret = rmi_read(address, 1, &c);
- return ret < 0 ? ret : c;
-}
-
-int rmi_write(int address, int byte_count, const unsigned char *buffer)
-{
- int ret;
- if((ret = rmi_select_page(address >> 8)) < 0)
- return ret;
- return i2c_writemem(rmi_i2c_addr, address & 0xff, buffer, byte_count);
-}
-
-int rmi_write_single(int address, unsigned char byte)
-{
- return rmi_write(address, 1, &byte);
-}
-
-/* set the device to the given sleep mode */
-void rmi_set_sleep_mode(unsigned char sleep_mode)
-{
- /* valid value different from the actual one*/
- if((dev_ctl_reg & RMI_SLEEP_MODE_BM) != sleep_mode)
- {
- dev_ctl_reg &= ~RMI_SLEEP_MODE_BM;
- dev_ctl_reg |= sleep_mode;
- rmi_write_single(RMI_DEVICE_CONTROL, dev_ctl_reg);
- }
-}
-
-/* set the device's report rate to the given value */
-void rmi_set_report_rate(unsigned char report_rate)
-{
- /* valid value different from the actual one*/
- if((dev_ctl_reg & RMI_REPORT_RATE_BM) != report_rate)
- {
- dev_ctl_reg &= ~RMI_REPORT_RATE_BM;
- dev_ctl_reg |= report_rate;
- rmi_write_single(RMI_DEVICE_CONTROL, dev_ctl_reg);
- }
-}