From patchwork Wed Dec 2 20:42:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Dyer X-Patchwork-Id: 7751731 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B24219F39D for ; Wed, 2 Dec 2015 20:53:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BA0F0203F1 for ; Wed, 2 Dec 2015 20:53:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5CF5E20534 for ; Wed, 2 Dec 2015 20:52:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756122AbbLBUwZ (ORCPT ); Wed, 2 Dec 2015 15:52:25 -0500 Received: from kdh-gw.itdev.co.uk ([89.21.227.133]:17281 "EHLO hermes.kdh.itdev.co.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756073AbbLBUvT (ORCPT ); Wed, 2 Dec 2015 15:51:19 -0500 Received: from localhost.localdomain (unknown [80.229.148.18]) (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 4C475809A1; Wed, 2 Dec 2015 20:42:38 +0000 (GMT) From: Nick Dyer To: Dmitry Torokhov Cc: Yufeng Shen , Benson Leung , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Alan Bowens , Javier Martinez Canillas , Chris Healy , Nick Dyer Subject: [PATCH RFC 7/8] Input: atmel_mxt_ts - add metadata to debugfs Date: Wed, 2 Dec 2015 20:42:30 +0000 Message-Id: <1449088951-7069-8-git-send-email-nick.dyer@itdev.co.uk> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1449088951-7069-1-git-send-email-nick.dyer@itdev.co.uk> References: <1449088951-7069-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, T_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 | 46 ++++++++++++++++++++++-- 2 files changed, 103 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 49fbe2a..dbe9ebb 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -236,23 +236,33 @@ struct mxt_object { struct mxt_debug_datatype { u8 mode; char *name; + char *desc; + char *format; }; struct mxt_debug_datatype_meta { struct mxt_data *data; const struct mxt_debug_datatype *datatype; struct dentry *dent; + u16 width; + u16 height; void *buf; + struct debugfs_blob_wrapper format_wrapper; + struct debugfs_blob_wrapper desc_wrapper; }; static const struct mxt_debug_datatype datatypes[] = { { .mode = MXT_DIAGNOSTIC_REFS, .name = "refs", + .desc = "Mutual Capacitance References", + .format = "uint16", }, { .mode = MXT_DIAGNOSTIC_DELTAS, .name = "deltas", + .format = "int16", + .desc = "Mutual Capacitance Deltas", } }; @@ -2277,6 +2287,7 @@ static void mxt_debugfs_init(struct mxt_data *data) struct mxt_dbg *dbg = &data->dbg; struct mxt_object *object; struct dentry *dent; + struct dentry *dir; struct mxt_debug_datatype_meta *dtm; char dirname[50]; int i; @@ -2333,13 +2344,42 @@ static void mxt_debugfs_init(struct mxt_data *data) for (i = 0; i < ARRAY_SIZE(datatypes); i++) { dtm = &data->dbg.dt_meta[i]; + dir = debugfs_create_dir(datatypes[i].name, dbg->debugfs_dir); + if (!dir) + goto error; + dtm->data = data; dtm->datatype = datatypes + i; + dtm->width = data->xy_switch ? data->ysize : data->xsize; + dtm->height = data->xy_switch ? data->xsize: data->ysize; dtm->buf = dbg->debug_buf; - dent = debugfs_create_file(datatypes[i].name, - S_IRUGO, dbg->debugfs_dir, - dtm, &atmel_mxt_dbg_fops); + dtm->format_wrapper.data = (void *)dtm->datatype->format; + dtm->format_wrapper.size = strlen(dtm->datatype->format); + dent = debugfs_create_blob("format", S_IRUGO, + dir, &dtm->format_wrapper); + if (!dent) + goto error; + + dtm->desc_wrapper.data = (void *)dtm->datatype->desc; + dtm->desc_wrapper.size = strlen(dtm->datatype->desc); + dent = debugfs_create_blob("name", S_IRUGO, + dir, &dtm->desc_wrapper); + if (!dent) + goto error; + + dent = debugfs_create_u16("width", S_IRUGO, + dir, &dtm->width); + if (!dent) + goto error; + + dent = debugfs_create_u16("height", S_IRUGO, + dir, &dtm->height); + if (!dent) + goto error; + + dent = debugfs_create_file("data", S_IRUGO, dir, dtm, + &atmel_mxt_dbg_fops); if (!dent) goto error;