chipone icn83xx and icn85xx touchscreen drivers

813 views
Skip to first unread message

sergk...@gmail.com

unread,
Feb 20, 2016, 2:53:20 PM2/20/16
to linux-sunxi
Hi all,
Could please somebody be so kind to describe or reference to datasheet of chipone85xx touchscreen controller.
AFAIK icn83xx is implemented in linux sunxi.
All I have discovered: http://www.chiponeic.com/index.php/website/products/18
But what is the logic?
How to init the chip? Chip is on i2c 0x48 address.
How to read x,y coordinates?
Which registers does it have and by what addresses?
By the link above tx,rx,osc por - what do they mean?
PS: I am trying to make it working icn85xx at baytrail arch with vanilla kernel.
Thanks in advance,
 Serge Kolotylo.

sergk...@gmail.com

unread,
Feb 24, 2016, 4:22:53 PM2/24/16
to linux-sunxi
Coud someone be so kind to describe how to initialize this chip?
I guess it has INT/WAKE gpio pin? Am I right?
How to find out having working touch in Android and Windows it ? There is no at the moment driver in Linux for this touch, so I have not "right point of start" for finding out gpio pin.
What is my current experience on Chuwi Vi10 with dualboot Android and Windows + ArchLinux:

I have tried to detect gpio INT/WAKE pin using sysfs and i2cdetect -r 4.

I have Android and Win with this touch, exploring
Android: registered on i2c-4 0x48.
In Linux nothing!!!! On this i2c bus via 0x48! This possibly means
that chip should be initialized to be detected\provide responce on i2c
bus, probably gpio pin for INT\WAKE.
Looking through all 1-512 (the last one available for export through
sysfs) + i2cdetect -r 4 under linux makes me completely confused -
changing direction to out of gpio[396,430,438,492] makes i2cdetect
discovers device on i2c-4, 0x48 and at the same time changinf value
(level) to 1 of gpio 473 and gpio 475 againg makes chip visible for
i2cdetect.
At the same time gpios 391-393 - just makes screen black, but do not
power off device.
Main question - which one of them  is for INT/WAKE of TS?

Regards and thanks in advance,
                                                Serge Kolotylo.

sergk...@gmail.com

unread,
Feb 27, 2016, 8:21:17 PM2/27/16
to linux-sunxi
Hi All :) that still keep silence!

I would like to mention the following :
In linux-sunxi there is http://dl.linux-sunxi.org/SDK/A80/A80_SDK_20140728_stripped/lichee/linux-3.4/drivers/input/touchscreen/icn83xx/
it is strange that the author is from Chipone, as minimum should be someone who adopt this code for sunxi.

Actually in my tablet (Chuwi vi10 11 rev) there is Chipone ICN8528.h that is  probably the same as 83xx.
Looks like INT/WAKE gpio pin is between 390-394, Taking into account my experience with Chuwi vi8 with GSL1680, - lets assume that it is the same in Vi10 - and that is gpio393.

QUESTIONS are:

1) How to initialize the chip? What is the sequence? It looks it is not enough just set gpio to 1.

From the code I see this but do not understand logic - please explain it more detailed!


int ctp_wakeup(int status,int ms)
{
        dprintk(DEBUG_INIT,"***CTP*** %s:status:%d,ms = %d\n",__func__,status,ms);

    if (status == 0) {
            if(ms == 0) {
                    __gpio_set_value(config_info.wakeup_gpio.gpio, 0);
            }else {
                    __gpio_set_value(config_info.wakeup_gpio.gpio, 0);
                    msleep(ms);
                    __gpio_set_value(config_info.wakeup_gpio.gpio, 1);
             }
    }
    if (status == 1) {
            if(ms == 0) {
                        __gpio_set_value(config_info.wakeup_gpio.gpio, 1);
              }else {
                        __gpio_set_value(config_info.wakeup_gpio.gpio, 1);
                        msleep(ms);
                        __gpio_set_value(config_info.wakeup_gpio.gpio, 0);
              }
     }
     msleep(5);

     return 0;




2) Please describe in a few words the feature of linux-sunxi - what is ctp_config_info and how input information goes to it.
for example in the mentioned above link there is such lines in icn83xx.c

#define CTP_IRQ_NUMBER          (config_info.int_number)              - WHERE THIS VALUE IS LOCATED OR HOW IT IS TAKEN - it is not determined in the .h or .c.
#define CTP_IRQ_MODE            (IRQF_TRIGGER_FALLING)

#define SCREEN_MAX_X            (screen_max_x)
#define SCREEN_MAX_Y            (screen_max_y)
#define PRESS_MAX            (255)

static int screen_max_x = 0;
static int screen_max_y = 0;
static int revert_x_flag = 0;
static int revert_y_flag = 0;
static int exchange_x_y_flag = 0;
static u32 int_handle = 0;
static __u32 twi_id = 0;

struct ctp_config_info config_info = {
        .input_type = CTP_TYPE,
        .name = NULL,
};


Regards and thanks in advance,
                                             Serge Kolotylo.

Gregor Riepl

unread,
Mar 1, 2016, 5:24:05 AM3/1/16
to linux...@googlegroups.com
> 1) How to initialize the chip? What is the sequence? It looks it is not enough
> just set gpio to 1.

I think many TS controllers use the same or a similar sequence to this:
- Set wakeup pin low
- Wait for a few ms
- Set wakup pin high

How long is probably chip dependant.

> 2) Please describe in a few words the feature of linux-sunxi - what is
> ctp_config_info and how input information goes to it.
> for example in the mentioned above link there is such lines in icn83xx.c

ctp_config is hardcoded crap and should not be in any proper driver, IMHO.

That information is better fetched from 1) ACPI or DT, if available, 2) made
available through sysfs, or 3) provided in the firmware.

1) silead_ts does this
2) chipone_icn8318 does this
3) gslx680-acpi does this

1) is probably the best option, but I don't really know if 2) or 3) is better
when 1) is not available. 2) requires user space interaction and 3) requires
specially formatted firmware.

Can you compare the actual I2C and GPIO code from chipone_icn8318 and
icn85xx.c and see if the work similarly? In that case, I believe we could just
add ACPI support and the correct ACPI IDs for your icn85xx to chipone_icn8318
and it should start working. Well, you still need proper firmware, I guess.
But let's leave that aside for now.

Gregor Riepl

unread,
Mar 1, 2016, 6:35:38 AM3/1/16
to linux...@googlegroups.com
> That information is better fetched from 1) ACPI or DT, if available, 2) made
> available through sysfs, or 3) provided in the firmware.
>
> 1) silead_ts does this
> 2) chipone_icn8318 does this

Sorry, I was mistaken. chipone_icn8318 tries to fetch the information from
DeviceTree. No sysfs interface is provided.

> 3) gslx680-acpi does this

Basically, the information that's needed is:

- Touchscreen resolution (horizontal and vertical)
- If the touchscreen is inverted horizontally or vertically
- If the x and y axes are swapped
- (For some devices) If finger tracking is supported in hardware

It's possible to recalibrate these to a certain degree, but this prevents the
device from "just working". And if finger tracking isn't supported, it will
behave very erratically.

sergk...@gmail.com

unread,
Mar 1, 2016, 12:06:28 PM3/1/16
to linux-sunxi
Hi Gregor,
Thank you for reply!
As I mentioned in linux-input@How to use ACPI for touchscreen  - the acpi provided info looks like total false.
For the begining I am trying to achieve mimimal - detect chip and just wake up it.
Actually have tried - modified your driver for gsl1680 and also icn8318 for acpi CHPN0001 - looks like it is working with just finding CHPN0001 but I could not wake up chip, as far as I am understanding wakeuping process - after wake up chip should be permanently visible to i2cdetect 4 on 0x048 - but it not happen so - only from time to time.
Registers data is different between icn8318 and 85xx.
I also belive that all is need is  - wakeup chip + load its firmware (I have it) and also described in linux input case how it works I guess indirect provs this too - so there is no need to wright from scratch driver with registering int, intprocessing function and so on, but  at the moment I am not sure, it is only my guessing.
Anyway even without INT just polling mode will be also good. ;-) any working solution even not perfect better than nothing!

Regards,
             Serge Kolotylo.

sergk...@gmail.com

unread,
Mar 1, 2016, 4:48:35 PM3/1/16
to linux-sunxi
Hi, Gregor.
Just wrote some my test module-stub, mix of acpi and just direct i2cdev creation on i2c-4 0x48, anyway it is even possible just used echo icn8528 0x48 > /sys/bus/i2c/devices/i2c-4/newdevice
instead it.
The main question is - wakeup chip, and gpios pins.



Actually, the procedure of hw_init icn85xx taken from https://github.com/bbelos/rk3188-kernel/blob/master/drivers/input/touchscreen/ICN8503/icn85xx.c
is the following:
MAIN QUESTIONS: how to find out analogs of CTP_RST_PORT, CTP_POWER_PORT.
CTP_NAME is CHPN0001 (taken from ACPI).

Kind regards,
                   Serge Kolotylo.

PS: actually I am missing a good explanation also of how to check what i have received from ACPI when I've used in during i2c client driver. I will ask this part at linux-input in ACPI and touchscreen thread.


static int icn85xx_hw_init(void)
{
    int err = 0;
    err = gpio_request(CTP_RST_PORT, CTP_NAME);
    if ( err ) {
        err = -EINVAL;
        return err;
    }
    err = gpio_direction_output(CTP_RST_PORT, 1);
    if ( err ) {
        err = -EINVAL;
        return err;
    }
   
    if(gpio_request(POWER_PORT,NULL) != 0){
        gpio_free(POWER_PORT);
        printk("zhongchu_init_platform_hw gpio_request error\n");
        return -EIO;
    }
    gpio_direction_output(POWER_PORT, 0);
    gpio_set_value(POWER_PORT,GPIO_LOW);
    msleep(20);

    gpio_set_value_cansleep(CTP_RST_PORT, 0);
    msleep(100);
    gpio_set_value_cansleep(CTP_RST_PORT, 1);
    msleep(300);
   
    return err;
}


Reply all
Reply to author
Forward
0 new messages