From patchwork Thu Dec 24 13:49:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Dyer X-Patchwork-Id: 7917921 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 B9753BEEE5 for ; Thu, 24 Dec 2015 13:53:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CDB5A20529 for ; Thu, 24 Dec 2015 13:53:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA9D720608 for ; Thu, 24 Dec 2015 13:53:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753298AbbLXNun (ORCPT ); Thu, 24 Dec 2015 08:50:43 -0500 Received: from kdh-gw.itdev.co.uk ([89.21.227.133]:45454 "EHLO hermes.kdh.itdev.co.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752799AbbLXNtj (ORCPT ); Thu, 24 Dec 2015 08:49:39 -0500 Received: from juno.kdh.itdev.co.uk (juno.kdh.itdev.co.uk [192.168.1.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by hermes.kdh.itdev.co.uk (Postfix) with ESMTPSA id 924707F3D2; Thu, 24 Dec 2015 13:49:35 +0000 (GMT) From: Nick Dyer To: Dmitry Torokhov Cc: Benson Leung , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Alan Bowens , Javier Martinez Canillas , Chris Healy , Nick Dyer Subject: [PATCH RFC v2 7/9] Input: atmel_mxt_ts - add metadata to debugfs Date: Thu, 24 Dec 2015 13:49:26 +0000 Message-Id: <1450964968-9792-8-git-send-email-nick.dyer@itdev.co.uk> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1450964968-9792-1-git-send-email-nick.dyer@itdev.co.uk> References: <1450964968-9792-1-git-send-email-nick.dyer@itdev.co.uk> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.9 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 Add information to debugfs to allow a generic utility to retrieve screen parameters and info. Signed-off-by: Nick Dyer --- Documentation/ABI/testing/debugfs-heatmap | 60 +++++++++++++++++++++++++++++++ drivers/input/touchscreen/atmel_mxt_ts.c | 48 +++++++++++++++++++++++-- 2 files changed, 105 insertions(+), 3 deletions(-) create mode 100644 Documentation/ABI/testing/debugfs-heatmap diff --git a/Documentation/ABI/testing/debugfs-heatmap b/Documentation/ABI/testing/debugfs-heatmap new file mode 100644 index 0000000..9246340 --- /dev/null +++ b/Documentation/ABI/testing/debugfs-heatmap @@ -0,0 +1,60 @@ +What: /sys/kernel/debug/heatmap-dev_driver_string-dev_name/ +Date: +KernelVersion: +Contact: +Description: + A directory will be created under heatmap for each device which + provides heatmap data. + +What: /sys/kernel/debug/heatmap-dev_driver_string-dev_name/datatype/ +Date: +KernelVersion: +Contact: +Description: + The device can have multiple heatmap data types. A directory is created + for each one. + +What: /sys/kernel/debug/heatmap-xxx/datatype/format +Date: +KernelVersion: +Contact: +Description: + Specifies the type of each data value, one of: + uint8 + uint16 + uint32 + int8 + int16 + int32 + +What: /sys/kernel/debug/heatmap-xxx/datatype/width +Date: +KernelVersion: +Contact: +Description: + The width of the data. + +What: /sys/kernel/debug/heatmap-xxx/datatype/height +Date: +KernelVersion: +Contact: +Description: + The height of the data. + +What: /sys/kernel/debug/heatmap-xxx/datatype/name +Date: +KernelVersion: +Contact: +Description: + Display name for the data. + +What: /sys/kernel/debug/heatmap-xxx/datatype/data +Date: +KernelVersion: +Contact: +Description: + Binary attribute for the data. + + The orientation of the data should correspond to the co-ordinates + reported to the input layer. Starting at the top left hand corner, rows + then columns. The endianness of data values will be as per host cpu. diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index bccd7bc..3f12915 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -236,21 +236,31 @@ struct mxt_object { struct mxt_debug_datatype { u8 mode; char *name; + char *desc; + char *format; }; struct mxt_debug_entry { struct mxt_data *data; const struct mxt_debug_datatype *datatype; + u16 width; + u16 height; + struct debugfs_blob_wrapper format_wrapper; + struct debugfs_blob_wrapper desc_wrapper; }; static const struct mxt_debug_datatype mxt_dbg_datatypes[] = { { .mode = MXT_DIAGNOSTIC_REFS, .name = "refs", + .desc = "Mutual Capacitance References", + .format = "uint16", }, { .mode = MXT_DIAGNOSTIC_DELTAS, .name = "deltas", + .desc = "Mutual Capacitance Deltas", + .format = "int16", }, }; @@ -2286,6 +2296,7 @@ static void mxt_debugfs_init(struct mxt_data *data) char dirname[50]; struct dentry *dent; struct mxt_debug_entry *e; + struct dentry *dir; int i; object = mxt_get_object(data, MXT_GEN_COMMAND_T6); @@ -2337,9 +2348,40 @@ static void mxt_debugfs_init(struct mxt_data *data) e->data = data; e->datatype = mxt_dbg_datatypes + i; - dent = debugfs_create_file(mxt_dbg_datatypes[i].name, S_IRUGO, - dbg->debugfs_dir, e, - &mxt_debugfs_data_ops); + dir = debugfs_create_dir(mxt_dbg_datatypes[i].name, + dbg->debugfs_dir); + if (!dir) + goto error; + + e->width = data->xyswitch ? data->ysize : data->xsize; + e->height = data->xyswitch ? data->xsize : data->ysize; + + e->format_wrapper.data = (void *)e->datatype->format; + e->format_wrapper.size = strlen(e->datatype->format); + dent = debugfs_create_blob("format", S_IRUGO, + dir, &e->format_wrapper); + if (!dent) + goto error; + + e->desc_wrapper.data = (void *)e->datatype->desc; + e->desc_wrapper.size = strlen(e->datatype->desc); + dent = debugfs_create_blob("name", S_IRUGO, + dir, &e->desc_wrapper); + if (!dent) + goto error; + + dent = debugfs_create_u16("width", S_IRUGO, + dir, &e->width); + if (!dent) + goto error; + + dent = debugfs_create_u16("height", S_IRUGO, + dir, &e->height); + if (!dent) + goto error; + + dent = debugfs_create_file("data", S_IRUGO, + dir, e, &mxt_debugfs_data_ops); if (!dent) goto error; }