From patchwork Fri Jul 23 13:52:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Cox X-Patchwork-Id: 113900 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6NEPEET018743 for ; Fri, 23 Jul 2010 14:25:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760222Ab0GWOZG (ORCPT ); Fri, 23 Jul 2010 10:25:06 -0400 Received: from mga01.intel.com ([192.55.52.88]:3200 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760181Ab0GWOZF (ORCPT ); Fri, 23 Jul 2010 10:25:05 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 23 Jul 2010 07:22:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.55,248,1278313200"; d="scan'208";a="820979313" Received: from unknown (HELO localhost.localdomain) ([10.255.13.60]) by fmsmga001.fm.intel.com with ESMTP; 23 Jul 2010 07:24:53 -0700 From: Alan Cox Subject: [PATCH 6/6] Simplify en/disable of interrupts for NEC. To: greg@kroah.com, linux-input@vger.kernel.org, dmitry.torokhov@gmail.com Date: Fri, 23 Jul 2010 14:52:38 +0100 Message-ID: <20100723135237.19151.43534.stgit@localhost.localdomain> In-Reply-To: <20100723134852.19151.6999.stgit@localhost.localdomain> References: <20100723134852.19151.6999.stgit@localhost.localdomain> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 23 Jul 2010 14:25:14 +0000 (UTC) diff --git a/drivers/staging/mrst-touchscreen/intel-mid-touch.c b/drivers/staging/mrst-touchscreen/intel-mid-touch.c index 760bc7b..4d27d6c 100644 --- a/drivers/staging/mrst-touchscreen/intel-mid-touch.c +++ b/drivers/staging/mrst-touchscreen/intel-mid-touch.c @@ -113,17 +113,7 @@ struct mrstouch_dev { static int mrstouch_nec_adc_read_prepare(struct mrstouch_dev *tsdev) { - u16 reg; - int err; - - err = intel_scu_ipc_ioread16(PMIC_REG_MADCINT, ®); - if (err) - return err; - - reg &= 0xDFFF; /* Disable pendet */ - - /* Set MADCINT and update ADCCNTL1 (next reg byte) */ - return intel_scu_ipc_iowrite16(PMIC_REG_MADCINT, reg); + return intel_scu_ipc_update_register(PMIC_REG_MADCINT, 0, 0x20); } /* @@ -131,53 +121,12 @@ static int mrstouch_nec_adc_read_prepare(struct mrstouch_dev *tsdev) */ static int mrstouch_nec_adc_read_finish(struct mrstouch_dev *tsdev) { - u16 reg; - u8 r; - u8 pendet_enabled; - int retry = 0; - int err; - - err = intel_scu_ipc_ioread16(PMIC_REG_MADCINT, ®); - if (err) - return err; - - reg &= ~0x0005; - reg |= 0x2000; /* Enable pendet */ - - /* Set MADCINT and update ADCCNTL1 (next reg byte) */ - err = intel_scu_ipc_iowrite16(PMIC_REG_MADCINT, reg); - if (err) - return err; - - /* - * Sometimes even after the register write succeeds - * the PMIC register value is not updated. Retry few iterations - * to enable pendet. - */ - do { - err = intel_scu_ipc_ioread8(PMIC_REG_ADCCNTL1, &r); - if (err) - return err; - - pendet_enabled = (r >> 5) & 0x01; - - if (!pendet_enabled) { - if (++retry >= 10) { - dev_err(tsdev->dev, - "Touch screen disabled.\n"); - return -EIO; - } - - msleep(10); - - err = intel_scu_ipc_iowrite8(PMIC_REG_ADCCNTL1, - reg >> 8); - if (err) - return err; - } - } while (!pendet_enabled); - - return 0; + int err = 0; + u8 madc = 0x20; + err = intel_scu_ipc_update_register(PMIC_REG_MADCINT, 0x20, 0x20); + if (!err) + err = intel_scu_ipc_update_register(PMIC_REG_ADCCNTL1, 0, 0x05); + return err; } /*