chuwi-dev icon indicating copy to clipboard operation
chuwi-dev copied to clipboard

CHUWI HI10 chipone_ts

Open zak53 opened this issue 8 years ago • 59 comments

Hi, I get this error modprobe chipone_ts cannot open firmware: icnfirmware.bin

zak53 avatar Jul 11 '16 10:07 zak53

The driver needs the touchscreen's firmware in order to use it. You can download it from windows drivers, I don't know if I'm allowed to upload it in this repository.

Currently, the driver is in development, and it looks for the firmware in the same folder of the chipone driver. I will add the "install" step in the Makefile and the correct firmware folder (usually /usr/lib/firmware) when I fix some issues :) Maybe I will add a Wiki page in order to use this driver.

I own a Chuwi Vi10 Ultimate and I have tested the driver there: please let me know if it works there too, so I can add another wiki page where people can see which tablet models supports this driver.

Maybe you need to change the screen resolution, because currently is hardcoded to 1366x768 (Vi10 Ultimate resolution). I still have to add two parameters so everyone can set the correct screen resolution without editing the source code.

Dax89 avatar Jul 11 '16 11:07 Dax89

img_20160709_203004 I also had this Problem /icnfirmware.bin pls update git and add you icnfirmware.bin

asyan4ik avatar Jul 12 '16 10:07 asyan4ik

I don't know if I'm allowed to upload it here, because it belongs to the windows driver, you can find it here: https://dl.dropboxusercontent.com/u/40206233/Chuwi/icnfirmware.bin

Dax89 avatar Jul 12 '16 11:07 Dax89

Thank you , i try tonight icnfirmware.bin windows file ? show me the way to icnfirmware.bin on my tablet no such this file oO

asyan4ik avatar Jul 12 '16 12:07 asyan4ik

not work for me (chuwi hi10) icnfirmware.bin load OK! irq error "IRQ Handler initialization failed"

asyan4ik avatar Jul 12 '16 20:07 asyan4ik

It seems that request_irq() call fails. I have added a more descriptive error message which includes the IRQ number (is hardcoded atm, because the kernel can't get it at boot time) and the error code, can you re-test the driver?

Dax89 avatar Jul 13 '16 07:07 Dax89

#define CHIPONE_IRQ 0x64 Error still here

zak53 avatar Jul 13 '16 09:07 zak53

Guys, I don't understand you, if you write "error here/there" you don't help me.

I have a single device and I can test it in a single configuration, so I need all possible informations in order to understand what's going on in other devices, if doesn't work and why, for example:

  • Which type of error, compilation or runtime one?
  • Which linux distribution?
  • Which kernel version?
  • Which device?
  • Driver compiles?
  • Driver fails the loading procedure?
  • Driver refuses to flash the firmware?
  • A dmesg log it's useful in order to try to fix issue

Thanks

Dax89 avatar Jul 13 '16 09:07 Dax89

how did you get this irq adresse 0x64 100 ?

zak53 avatar Jul 13 '16 09:07 zak53

Yesterday I have noticed that the kernel fails to get the IRQ number at runtime, in fact in dmesg output I see:

i2c_hid i2c-CHPN0001:00: Failed to get GPIO interrupt

so I was forced to hardcode its number in order to load the driver and handle touch events at boot time.

If Hi10 uses a different IRQ number I can hardcode it in the the source code as well, this workaround makes the touchscreen usable until someones fixes i2c_hid driver.

I have just added a debug message which prints the "real" IRQ number, in order to get it you can do the following steps:

Clone the repo and remove the current driver:

git clone https://github.com/Dax89/chuwi-dev.git
cd chuwi-dev/drivers/chipone_ts
sudo make uninstall

reboot, compile and load the new driver manually:

make
sudo insmod chipone_ts.ko

and look in "dmesg" for the string "Kernel reports IRQ:", if it's different than 0x64 I will add the correct Hi10's IRQ number to the source code.

Dax89 avatar Jul 13 '16 10:07 Dax89

0xb9 185

zak53 avatar Jul 13 '16 12:07 zak53

I added the code to the source code and now ts work

zak53 avatar Jul 13 '16 12:07 zak53

Thanks! :)

IRQ Added here: https://github.com/Dax89/chuwi-dev/commit/9361cbafa96318e03b309c5fb17a7954c80589c3 You can build the driver for hi10 (resolution 1920x1080 and IRQ=0xB9) by typing make hi10 instead of make

Dax89 avatar Jul 13 '16 12:07 Dax89

Work It! 0xb8 Dev res 1200x1920 [ 165.792874] chipone_ts: module verification failed: signature and/or required key missing - tainting kernel [ 165.978559] chipone_ts i2c-CHPN0001:00: Kernel reports IRQ: 0xb8 [ 165.979080] input: CHPN0001:00 as /devices/pci0000:00/808622C1:05/i2c-13/i2c-CHPN0001:00/input/input7 [ 165.980001] chipone_ts i2c-CHPN0001:00: Device 'CHPN0001:00' registration succeeded [ 165.995243] chipone_ts i2c-CHPN0001:00: Downloading firmware '/lib/firmware/chipone_ts/icnfirmware.bin'... [ 168.041772] chipone_ts i2c-CHPN0001:00: Firmware download completed, CRC OK [ 168.041794] chipone_ts i2c-CHPN0001:00: Booting from SRAM... [ 168.042703] chipone_ts i2c-CHPN0001:00: Boot OK chuwi-dev@hi10 ~/chuwi_dev/rtl8723bs-master $ xinput ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ USB Mouse id=11 [slave pointer (2)] ⎜ ↳ CHPN0001:00 id=12 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ Power Button id=6 [slave keyboard (3)] ↳ Video Bus id=7 [slave keyboard (3)] ↳ Power Button id=8 [slave keyboard (3)] ↳ Madcatz Mad Catz S.T.R.I.K.E.3 Keyboard id=9 [slave keyboard (3)] ↳ Madcatz Mad Catz S.T.R.I.K.E.3 Keyboard id=10 [slave keyboard (3

asyan4ik avatar Jul 13 '16 18:07 asyan4ik

Mmmh, I think that the kernel assigns a different IRQ number according to the current device configuration, I will do some testing in order to get it dynamically

Dax89 avatar Jul 13 '16 19:07 Dax89

bug . input reversed

asyan4ik avatar Jul 13 '16 19:07 asyan4ik

bug . input reversed

Input reversed? Can you elaborate?

I have added some enhancements to the driver, now it should be able to "guess" the IRQ number without the need to hardcode it (needs testing btw) and I have added an usermode feature that allow users to read touchscreen's data in realtime (useful for debugging):

Header Registers:

watch -n 1 cat /sys/bus/i2c/drivers/chipone_ts/i2c-CHPN0001\:00/headerarea
work_mode: 0
system_busy_flag: 0
reserved1: [0, 0]
cmd: 0
power_mode: 0
reserved2: 0
charger_plugin: 1
reserved3: 0
lib_version: 31
ic_version_main: 86
ic_version_sub: 8
fw_main_version: 31
fw_sub_version: 2f
customer_id: 4
product_id: 0

Coordinate Registers (I will add extended touch information later):

watch -n 1 cat /sys/bus/i2c/drivers/chipone_ts/i2c-CHPN0001\:00/coordinatearea
gesture_id: 0
num_pointer: 1

Used IRQ number:

cat /sys/bus/i2c/drivers/chipone_ts/i2c-CHPN0001\:00/irq
0x64

I will add a wiki page for the register's meaning later, unfortunately I know only few of them, for example, in my Vi10 Ultimate gesture_id = 0 means touches and gesture_id = 1 means windows logo pressed.

Dax89 avatar Jul 14 '16 16:07 Dax89

I think all of the problem in icnfirmware.bin . this file for 1366х768 res vi10 hi10 have 1920x1200 resolution screen default

asyan4ik avatar Jul 14 '16 18:07 asyan4ik

Did you have tried with make hi10?

Using make only compiles the driver with 1366x768

Dax89 avatar Jul 14 '16 19:07 Dax89

yes . make hi10

asyan4ik avatar Jul 14 '16 19:07 asyan4ik

Try with screen calibrator . I think the problem is icnfirmware.bin

zak53 avatar Jul 14 '16 20:07 zak53

I will try to make those HAMPXXXX files flashable.

I'm also thinking to make those two firmwares compiled inside the driver, what do you think?

Dax89 avatar Jul 14 '16 20:07 Dax89

i have a trouble after last fixes , touch not work screenshot from 2016-07-14 20-42-12 screenshot from 2016-07-14 20-42-49 screenshot from 2016-07-14 20-44-54 screenshot from 2016-07-14 20-45-36 screenshot from 2016-07-14 20-46-18

asyan4ik avatar Jul 14 '16 20:07 asyan4ik

Zak , if you touchscreen work try xinput_calibrator

asyan4ik avatar Jul 14 '16 20:07 asyan4ik

I will try to make those HAMPXXXX files flashable.

I'm also thinking to make those two firmwares compiled inside the driver, what do you think?

Yes good idea like this one https://github.com/bbelos/rk3188-kernel/tree/master/drivers/input/touchscreen/ICN850X

zak53 avatar Jul 14 '16 20:07 zak53

Ok I have tried to flash the HAMP file, the data is flashed correctly but I think that the touchscreen's register which keeps the firmware's length is 16 bit wide and the maximum file size can be 65535 bytes.

[ 2012.529807] chipone_ts i2c-CHPN0001:00: Device 'CHPN0001:00' registration succeeded
[ 2012.555557] chipone_ts i2c-CHPN0001:00: Downloading firmware 'V300'
[ 2037.721070] chipone_ts i2c-CHPN0001:00: crcresult vs crc: 0x5d8184d0 -> 0x5d8184d0
[ 2037.721096] chipone_ts i2c-CHPN0001:00: crclen vs len: 50740 -> 181812
[ 2037.721110] chipone_ts i2c-CHPN0001:00: Firmware download failed: Length Error

That could be wrong, I don't have any documentation about the flashing procedure. I have also checked the windows driver for Hi10, it seems that the driver keeps the firmware in the windows registry and its key seems to be named ICNFirmware or, if it is a file, it's named ICN87xx.bin and it should be somewhere in windows partition.

Can you confirm this? If the key or the file exists can you compare its data with the HAMPXXXX files?

Thanks

@asyan4ik I will look at that later :)

Dax89 avatar Jul 15 '16 09:07 Dax89

Will install windows and look to this file

zak53 avatar Jul 15 '16 09:07 zak53

2016-07-15 14-07-27

asyan4ik avatar Jul 15 '16 11:07 asyan4ik

after 5 times xinput_calibrator touch work fine =))))

asyan4ik avatar Jul 15 '16 11:07 asyan4ik

That one is the windows driver :)

Dax89 avatar Jul 15 '16 12:07 Dax89

In the last commit I have added some support for the firmware's configuration area, it's still a bit unknown memory area but it's possible to change some firmware's parameters on the fly including the screen's resolution.

I have tried to load the driver with 1920x1200 on mi Vi10 and the cursor is uncalibrated, maybe on a real Hi10 with that resolution works fine.

@asyan4ik try with the last commit, maybe you need to re-calibrate your input again :)

EDIT: It's possible to see some parameters in user mode with:

cat /sys/bus/i2c/devices/i2c-CHPN0001\:00/configurationarea
res_x: 1200
res_y: 1920
row_num: 36
col_num: 20

I think that the screen is assembled as portrait, in fact width and height are swapped, the driver takes care of them.

Dax89 avatar Jul 15 '16 12:07 Dax89

Mmmh, no it's available as downloadable windows driver along with the firmware file.

Dax89 avatar Jul 15 '16 12:07 Dax89

if the hi10 ts work fine without this HAMPXXXX firmware then it's ok no need for v300 firmware

zak53 avatar Jul 15 '16 12:07 zak53

2016-07-15 15-52-35wtf ?

cat /sys/bus/i2c/devices/i2c-CHPN0001:00/configurationarea res_x: 1200 res_y: 1920 row_num: 36 col_num: 20

asyan4ik avatar Jul 15 '16 12:07 asyan4ik

Did you have touched the capacitive "windows" button? The screen generates notifications when is pressed

Dax89 avatar Jul 15 '16 12:07 Dax89

1 yes , have win button . i don't touch her 2 does not work right 1-2cm touchscreen

asyan4ik avatar Jul 15 '16 13:07 asyan4ik

1: I will add some more checks in order to avoid duplicate events 2: top right or bottom right?

Dax89 avatar Jul 15 '16 13:07 Dax89

drawing if touch this area of the screen cursor is moved to the very edge of the screen sorry my english and my paint =)

asyan4ik avatar Jul 15 '16 13:07 asyan4ik

hello ! After last commit win button not flood over . its good =)

asyan4ik avatar Jul 16 '16 09:07 asyan4ik

I have added a real action for the capacitive button, now it acts like Windows button on your keyboard (on KDE/Plasma, when KSuperKey is installed it triggers Kickoff menu).

There is also some extended information about the touch coordinates, which should help us to fix the "dead area" in Hi10's touch screen.

New configuration_area output:

[davide@ChuwiVi10U chipone_ts]$ cat /sys/bus/i2c/devices/i2c-CHPN0001\:00/configurationarea
res_x: 768
res_y: 1366
row_num: 36
col_num: 20
num_vkey: 1
vkey_mode: 3
vk_down_threshold: 130
vk_up_threshold: 100
max_touch_num: 10
threshold_dync_mode: 20
high_sense_threshold: 60
touch_up_threshold: 100
touch_down_threshold: 0
touch_charger_threshold: 3
xy_swap: 0
int_mode: 1
int_keep_time: 100
wake_up_pol: 10
gpio_vol: 0
report_rate: 208
enter_monitor_cnt: 7

New coordinate_area output:

[davide@ChuwiVi10U chipone_ts]$ cat /sys/bus/i2c/devices/i2c-CHPN0001\:00/coordinatearea
Last event on: 12:04:09
gesture_id: 0
num_pointer: 1
pointer[0]: id: 0, (x: 1365, y: 767), pressure: 0, event_id: 4
pointer[1]: id: 0, (x: 0, y: 0), pressure: 0, event_id: 0
pointer[2]: id: 0, (x: 0, y: 0), pressure: 0, event_id: 0
pointer[3]: id: 0, (x: 0, y: 0), pressure: 0, event_id: 0
pointer[4]: id: 0, (x: 0, y: 0), pressure: 0, event_id: 0
pointer[5]: id: 0, (x: 0, y: 0), pressure: 0, event_id: 0
pointer[6]: id: 0, (x: 0, y: 0), pressure: 0, event_id: 0
pointer[7]: id: 0, (x: 0, y: 0), pressure: 0, event_id: 0
pointer[8]: id: 0, (x: 0, y: 0), pressure: 0, event_id: 0
pointer[9]: id: 0, (x: 0, y: 0), pressure: 0, event_id: 0

NOTE 1: "num_pointer" tells how many pointer[x] data are valid, all other items beyond that value are invalid and it contains "random data".

NOTE 2: It's possible to use the watch command like before in order to read the data in realtime.

Dax89 avatar Jul 16 '16 12:07 Dax89

2016-07-16 17-59-12 need mirror deploy touch action

asyan4ik avatar Jul 16 '16 15:07 asyan4ik

Mmmmh, you're right, it seems that the screen is mirrored.

Can you post the configuration area's parameters (look above how to do it)?

EDIT: Maybe the accelerometer can help us

Dax89 avatar Jul 16 '16 15:07 Dax89

asyan4ik@asyan4ik-Default-string ~/Изображения $ cat /sys/bus/i2c/devices/i2c-CHPN0001:00/configurationarea

res_x: 1200
res_y: 1920
row_num: 36
col_num: 20
num_vkey: 1
vkey_mode: 3
vk_down_threshold: 130
vk_up_threshold: 100
max_touch_num: 10
threshold_dync_mode: 20
high_sense_threshold: 60
touch_up_threshold: 100
touch_down_threshold: 0
touch_charger_threshold: 3
xy_swap: 0
int_mode: 1
int_keep_time: 100
wake_up_pol: 10
gpio_vol: 0
report_rate: 208
enter_monitor_cnt: 7

asyan4ik avatar Jul 16 '16 15:07 asyan4ik

Thanks a lot! :) A part for the resolution, data are identical.

I have a (unconfirmed) theory about this issue: we need a working accelerometer, because the LCD panel seems to be assembled rotated by 180° but the touch panel is in the correct side.

With the accelerometer I can rotate the LCD panel's content in the same side of the touch panel and it (should) work correctly.

Dax89 avatar Jul 16 '16 15:07 Dax89

it's not good news =(

asyan4ik avatar Jul 16 '16 16:07 asyan4ik

accelerometer i think hi10 use BMA2X2 https://github.com/BoschSensortec/BMA2x2_driver/blob/master/bma2x2.c

zak53 avatar Jul 16 '16 16:07 zak53

Yes it's the same in Vi10.

Those file aren't the driver itself, but they contains some helper functions in order to get data from the accelerometer.

I'm already able to get data from it, so that driver should be available very soon and we'll be able to rotate the screen according to its orientation :)

I'm reading the datasheet of BMA2X2, and it seems that contains a sensor temperature too, which is pretty cool!

Dax89 avatar Jul 16 '16 17:07 Dax89

I'm ready and waiting for any tests =D

asyan4ik avatar Jul 16 '16 17:07 asyan4ik

hi, what's the news on accelerometer ?

asyan4ik avatar Jul 18 '16 17:07 asyan4ik

I'm starting to get readings from the accelerometer, but the driver is not in good shape that's why I have not uploaded the code yet :)

Dax89 avatar Jul 19 '16 07:07 Dax89

ok ,if you need a tester write me [email protected]

asyan4ik avatar Jul 19 '16 07:07 asyan4ik

I can post here too, so everyone can test it

Dax89 avatar Jul 19 '16 07:07 Dax89

well, I'm really looking forward to this

asyan4ik avatar Jul 19 '16 07:07 asyan4ik

I'm also available for beta tests :)

OutdoorMe avatar Jul 29 '16 14:07 OutdoorMe

Hi All,

Not sure of this is the best place to discuss this, but this seems to be the place where most discussion is.

Quick self intro: I'm a Linux kernel developer with 15 years of experience. As a side project I've been working for the last couple of months on improving Linux support for Bay and Cherry Trail devices, see: http://hansdegoede.livejournal.com/18017.html .

I recently bought a 2nd hand Chuwi Vi8 plus and started working on getting the touchscreen working before finding Dax89's chipone_ts driver. As such I've taken a somewhat different approach, the icn8505 chip used in my Vi8 Plus has a similar protocol to the icn8318 for which I've already written (and mainlined) a driver a while back. So I've extended that driver to also support the icn8505, see here for my patches against 4.12-rc5 for this: https://fedorapeople.org/~jwrdegoede/icn8505/ .

If someone with a Hi10 or a Vi10 Ultimate can give these a try to make sure that they work on those models too, that would be great. One way to do this is to build from my personal git-repo which already has a .config enabling all the right options, this will e.g. also give you working battery monitoring. You can find my personal kernel tree here: https://github.com/jwrdegoede/linux-sunxi, git clone this and then follow your distros instructions for building a kernel from source, note this kernel uses a generic distro config so you will need to generate an initrd (most distro instructions include this step).

I've also taken a different approach to the firmware issue. Since at least on my model the BIOS already loads the firmware I've made sure that the controller never gets reset instead of adding firmware loading support, this avoids the problem of needing to redistribute the firmware. See here for a discussion about this: https://patchwork.kernel.org/patch/9794051/ .

Regards,

Hans

jwrdegoede avatar Jun 18 '17 10:06 jwrdegoede

Hi Again,

I've also taken a quick peek at: https://github.com/Dax89/chuwi-dev/wiki/Chuwi-Vi10-Ultimate , the table there is not entirely accurate anymore:

  • Accelerometer, I believe this is supported by the existing iio bmc150 accelerometer driver, it just needs the BOSC0200 id added to the driver, I will take a look at this soon
  • Battery, this works with kernel 4.12 if all the AXP288 kernel config options are enabled
  • Wifi, I've fixed the ISO codes errors, the fix for this is in 4.12

Regards,

Hans

jwrdegoede avatar Jun 18 '17 10:06 jwrdegoede

Ok, I've the accelerometer working now, patch here: https://fedorapeople.org/~jwrdegoede/0001-iio-accel-bmc150-Add-support-for-BOSC0200-ACPI-devic.patch

jwrdegoede avatar Jun 18 '17 10:06 jwrdegoede

Hi @jwrdegoede Yes, it's a good place to talk about this.

For the best ones, you can look at:

  • https://techtablets.com/forum/topic/linux-mint-on-a-chuwi-hi10-tablet
  • https://techtablets.com/forum/topic/linux-on-atom-based-devices
  • https://forums.linuxmint.com/viewtopic.php?t=223426

These are the places where more people can read your progress and doing some testing with similar devices (Vi8, Vi10, Vi10U, Hi10 and so on) :)

Dax89 avatar Jun 18 '17 11:06 Dax89

Hello.

I'm trying to activate the touch screen of my chuwi hi10 table. I am under Ubuntu Mate 18.04.2 LTS with kernel 4.20.

Can not compile:

sdurand@tabastro:~/toutch/chuwi-dev/drivers/chipone_ts$ make hi10
KCPPFLAGS="-DCONFIG_HI10=1" make default 
make[1] : on entre dans le répertoire « /home/sdurand/toutch/chuwi-dev/drivers/chipone_ts »
make -C /lib/modules/4.20.17-042017-generic/build M=/home/sdurand/toutch/chuwi-dev/drivers/chipone_ts modules
make[2] : on entre dans le répertoire « /usr/src/linux-headers-4.20.17-042017-generic »
  CC [M]  /home/sdurand/toutch/chuwi-dev/drivers/chipone_ts/chipone_main.o
  CC [M]  /home/sdurand/toutch/chuwi-dev/drivers/chipone_ts/chipone_fw.o
In file included from /home/sdurand/toutch/chuwi-dev/drivers/chipone_ts/chipone_fw.c:2:0:
./arch/x86/include/asm/uaccess.h:30:27: error: unknown type name ‘mm_segment_t’; did you mean ‘apm_event_t’?
 static inline void set_fs(mm_segment_t fs)
                           ^~~~~~~~~~~~
                           apm_event_t
scripts/Makefile.build:291: recipe for target '/home/sdurand/toutch/chuwi-dev/drivers/chipone_ts/chipone_fw.o' failed
make[3]: *** [/home/sdurand/toutch/chuwi-dev/drivers/chipone_ts/chipone_fw.o] Error 1
Makefile:1562: recipe for target '_module_/home/sdurand/toutch/chuwi-dev/drivers/chipone_ts' failed
make[2]: *** [_module_/home/sdurand/toutch/chuwi-dev/drivers/chipone_ts] Error 2
make[2] : on quitte le répertoire « /usr/src/linux-headers-4.20.17-042017-generic »
Makefile:12: recipe for target 'default' failed
make[1]: *** [default] Error 2
make[1] : on quitte le répertoire « /home/sdurand/toutch/chuwi-dev/drivers/chipone_ts »
Makefile:15: recipe for target 'hi10' failed
make: *** [hi10] Error 2


dragonlost avatar Mar 23 '19 13:03 dragonlost