From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754046AbbJHKyZ (ORCPT ); Thu, 8 Oct 2015 06:54:25 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:61632 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753638AbbJHKyX (ORCPT ); Thu, 8 Oct 2015 06:54:23 -0400 From: Arnd Bergmann To: Irina Tirdea Cc: Dmitry Torokhov , Bastien Nocera , Aleksei Mamlin , linux-input@vger.kernel.org, Mark Rutland , Octavian Purdila , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v7 2/9] Input: goodix - reset device at init Date: Thu, 08 Oct 2015 12:54:05 +0200 Message-ID: <8618206.7jshXjkP9U@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1444299575-17417-3-git-send-email-irina.tirdea@intel.com> References: <1444299575-17417-1-git-send-email-irina.tirdea@intel.com> <1444299575-17417-3-git-send-email-irina.tirdea@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:RRHdavQvrfnMCUhZtF/jr1ZtbYWuWP28Y1Sq7DUJon7gBGLSepp 8+WM+0NDGGmFvmKRyPXRoKe0KibCbdyGX5W1q5XoXTsFnl2+IfLs98eD692NTNdmfFm8N8K UG73Zj/CsI/2cf8FdRfsTyLGm+rS5Nxjk7HtYZL/CFVaOjLSawnbuXrfKEFqYtmg9LHkazp jC+9087lIAS9oXuTXmC9Q== X-UI-Out-Filterresults: notjunk:1;V01:K0:9ryIJDe2rLE=:Xz0RsbSYBr4NcIqQR+4QPv CoPGYE6sa1MA3X37zfIJaxHg8N7MMTmuasWm5mCHU/T/rG8Zn30nBYEjuhVeCZA5nP45Hv78z DuCZmRtODklkR/3gelgzR9/xe/j8V4q9MRMST1C/FWIemksJEGC+uMCKnDMuwrs5wX5b1mkNQ rnLLOdQged9RTa3p19etcnhyw9Q3e/N7Zr8DM7OlOFCIdzJbqoMv1XGaSnJRkhFiz+U5sPIG3 w29Of6V3WZtX3AuHAGgueIhbJCriQjsU32if8pCrecUCOFW0jmbJW+liQAvJce7ImaDMm4Rzp imNIThsLGNBhmjvaCogoe9tBIW3AIt4AJFYolotPgKk5Dmg8ltx+Shq4bx7tZu9iKoDuaTisK /TiLqSWIRoaFgT6J1kx/cKSJctp82orORYhE1qDSrnaqPYLl24jRvYJ2SKJCjARYyZLPk7u7Q rZmYlylo0YozJimqC673FIVpdcMb2DxY8luRLOffehXbjzmV3ePIIAjD2j/7PFJ9YjKgg49J1 vzKQTC1JN/2DTgMAmTodmDfZpUS49vMXOLlLg0RzBzei+yjPYuYROQUOWoO5nzkxcCan2JtG6 X7NBMVIJwNaeneRhlofQNz/8QwVQ/9dXg72pY0EB/noUK0iM15i/M2WRgSl70yl9EHwYoAi93 PfCeJGL+Aw3wwZkmHwlOqptOapoZD9JpfsRcH0WU6xJzz09BZrwFzCWZltuh9XwsdAbGHUtVN rGx24O3xTtsukP5+ Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday 08 October 2015 13:19:28 Irina Tirdea wrote: > After power on, it is recommended that the driver resets the device. > The reset procedure timing is described in the datasheet and is used > at device init (before writing device configuration) and > for power management. It is a sequence of setting the interrupt > and reset pins high/low at specific timing intervals. This procedure > also includes setting the slave address to the one specified in the > ACPI/device tree. > > This is based on Goodix datasheets for GT911 and GT9271 and on Goodix > driver gt9xx.c for Android (publicly available in Android kernel > trees for various devices). > > For reset the driver needs to control the interrupt and > reset gpio pins (configured through ACPI/device tree). For devices > that do not have the gpio pins declared, the functionality depending > on these pins will not be available, but the device can still be used > with basic functionality. > > For both device tree and ACPI, the interrupt gpio pin configuration is > read from the "irq-gpio" property and the reset pin configuration is > read from the "reset-gpio" property. For ACPI 5.1, named properties > can be specified using the _DSD section. If there is no _DSD section > in the ACPI table, the driver will fall back to using indexed gpio > pins declared in the _CRS section. Would it help to use a plain "gpios" property here to always look up the lines by index? > +/* > + * Some platforms specify the gpio pins for interrupt and reset properly > + * in ACPI, but cannot use the interrupt pin as output due to their specific > + * HW configuration. > + */ > +static const struct dmi_system_id goodix_no_gpio_pins_support[] = { > +#if defined(CONFIG_DMI) && defined(CONFIG_X86) > + { > + .ident = "Onda v975w", > + .matches = { > + DMI_MATCH(DMI_BIOS_VENDOR, "American Megatrends Inc."), > + DMI_MATCH(DMI_PRODUCT_UUID, > + "03000200-0400-0500-0006-000700080009"), > + DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), > + DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"), > + } > + }, I think lists like this in drivers should be avoided if at all possible, it just leads to other people adding their platform in the lists as opposed to fixing their boot loaders. Can you find another way to detect at runtime whether it works, and print a warning if it doesn't? If there is no way to detect that kind of device, we should probably have another property that the driver can read to determine this, so we can avoid adding each system here. > + /* HIGH: 0x28/0x29, LOW: 0xBA/0xBB */ > + error = gpiod_direction_output(ts->gpiod_int, ts->client->addr == 0x14); > + if (error) > + return error; If the "interrupt" gpio is used as an output, maybe it has the wrong name? Is that the name from the goodix datasheet (that would be ok) or something you picked? Arnd