From patchwork Fri Jul 31 17:42:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot for Irina Tirdea X-Patchwork-Id: 6915171 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 11F14C05AC for ; Fri, 31 Jul 2015 17:47:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2859A20498 for ; Fri, 31 Jul 2015 17:47:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2DE82203A0 for ; Fri, 31 Jul 2015 17:47:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754305AbbGaRrR (ORCPT ); Fri, 31 Jul 2015 13:47:17 -0400 Received: from mga01.intel.com ([192.55.52.88]:36861 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753104AbbGaRnB (ORCPT ); Fri, 31 Jul 2015 13:43:01 -0400 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 31 Jul 2015 10:42:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,585,1432623600"; d="scan'208";a="533819037" Received: from itirdea-desk.rb.intel.com ([10.237.104.68]) by FMSMGA003.fm.intel.com with ESMTP; 31 Jul 2015 10:42:40 -0700 From: Irina Tirdea To: Dmitry Torokhov , Bastien Nocera , linux-input@vger.kernel.org Cc: Mark Rutland , Octavian Purdila , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Irina Tirdea Subject: [PATCH v4 8/8] DO NOT APPLY! goodix configuration update helper Date: Fri, 31 Jul 2015 20:42:12 +0300 Message-Id: <1438364532-27150-9-git-send-email-irina.tirdea@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1438364532-27150-1-git-send-email-irina.tirdea@intel.com> References: <1438364532-27150-1-git-send-email-irina.tirdea@intel.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch is not meant to be applied. It can be used to test updates to the goodix touchscreen configuration. It provides a bash script to help generate a new configuration starting from the one read from the device. Below are instructions on how to test that the config is correctly updated for goodix 911 touchscreens. For other models you need to replace 911 with your model ID. On the target: - dump current configuration of the device: $ cat /sys/class/input/input4/device/dump_config > goodix_911_cfg On the host: - modify some fields from goodix_911_cfg (e.g. change resolution of x/y axes, maximum reported touch points, switch X,Y axes). For more details check datasheet for format of Configuration Registers. - run tools/touch-goodix-generate-fw.sh on the modified script to obtain a valid config (it needs to recompute the checksum, set Config_Fresh to 1 and generate the binary config firmware image): $ ./tools/touch-goodix-generate-fw.sh goodix_911_cfg - copy goodix_911_cfg.bin on the target in /lib/firmware - when the goodix driver is initialized it will read the new config firmware from /lib/firmware/goodix_911_cfg.bin and write it to the device - check that the new firmware was actually written to the device by reading the config again on the target from /sys/class/input/input4/device/dump_config. Also check that Config_Fresh has been reset to 0. You can also check if the functionality changed in the config has actually changed (reported resolution for x/y has changed, x,y axis are switched, etc.) Signed-off-by: Irina Tirdea --- tools/touch-goodix-generate-fw.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 tools/touch-goodix-generate-fw.sh diff --git a/tools/touch-goodix-generate-fw.sh b/tools/touch-goodix-generate-fw.sh new file mode 100755 index 0000000..0efe2e1 --- /dev/null +++ b/tools/touch-goodix-generate-fw.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +if [[ $# -lt 1 ]]; then + echo "$0 fw_filename" + exit 1 +fi + +file_in="$1" +file_out_bin=${file_in}.bin + +print_val () +{ + val="$1" + printf "0x%.2x" "$val" | xxd -r -p >> ${file_out_bin} +} + +rm -f ${file_out_bin} + +size=`cat ${file_in} | wc -w` + +checksum=0 +i=1 +for val in `cat ${file_in}`; do + val="0x$val" + if [[ $i == $size ]]; then + # Config_Fresh + print_val 0x01 + elif [[ $i == $((size-1)) ]]; then + # Config_Chksum + checksum=$(( (~ checksum + 1) & 0xFF)) + print_val $checksum + else + checksum=$((checksum + val)) + print_val $val + fi + i=$((i+1)) +done + +echo "Wrote ${file_out_bin}"