Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1349937ybp; Thu, 17 Oct 2019 11:26:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7udlKSlkUQ2H/w5/Ss0vNp4b0IMmNpLNKUTWbea4dveAp4VeHA/Mc711IQtRzI2Sk2NZV X-Received: by 2002:a50:9fe7:: with SMTP id c94mr5259068edf.249.1571336798404; Thu, 17 Oct 2019 11:26:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571336798; cv=none; d=google.com; s=arc-20160816; b=ZkboGMqR8CrpW3SgD76cGyeFYAPm+r7rXKLPlxhAe4RVK/Dr2mfo8RXVGj6U6ZHHD5 fAXLhh9lch3CtAriGAQlkDxLuMkuawN1rGD2PxC3cHChcD3Sqd1/v65i0ug4Z+lf2UsV DqBs0iH1AhDHdgCI6AxH0CL9rESvHGwDAfHCZw191UhH14ZckpJuPGtAvGdZ0g7+UkXT B60sa4cC7joBP7GddvNycwp6r73LBGcEgKbLrpeXezmy5Iy64qJWqXRMALfouqbnrpnI rgD+N/gblTTm/YXCh61LP+42qeb1DVw1jI/xYrMOlAlmGY7Zb//1mMyyyM0ZUs3wcdxs 0Z9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Frs6C4HFJUO0rEn3wrFMno7qaW5FD6WzvK5UJ4OVgPY=; b=w5w8ZImus8cTRWMhNCNonAc98vTMQ07Ayxp/Prss3eWSVpvMMNO7Hrv/tfX0VEATVl XhcRokrVzSHbF9ApLNAA0tyxGdJjnaZ0AdXr3ZHfYomgHbuNrZJO7zy7y4enhj9obQ6o NmSeOCAnObYtqk6kEwp0I3+Hli0x/HmKopvKR5UczoJJqa9vzGIQrpMCoB+IBs91+1Kz bJ3y6Y+/6FEfWCTgwg5nmfODbdnz1MRvvo3ILAlqh2MeV5/8HKHhZvvV5f+3pSaOvUiF XSX2FM0/P+ZRvuwJ/N4px09m8DQvnYzceb1FaIs7yRae7Oba8sJAUyRmCdAf5ayntdWU q9Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fDgbxe9k; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z35si2136411edd.340.2019.10.17.11.26.15; Thu, 17 Oct 2019 11:26:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fDgbxe9k; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406909AbfJPWFV (ORCPT + 99 others); Wed, 16 Oct 2019 18:05:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:52810 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438289AbfJPV6w (ORCPT ); Wed, 16 Oct 2019 17:58:52 -0400 Received: from localhost (unknown [192.55.54.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 23A0321A49; Wed, 16 Oct 2019 21:58:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571263131; bh=XetBPANB7qMSie4eeolBAhW/CmuTR4aFTc+RdDPIpL4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fDgbxe9k4I/tPlRtCIHKQAXfLuUbVQp8JQG9c+bTDFFpZRmeXTjLOYc+EUx1XS7AB wizPVqx40H90laPqyeBsnoLYufDLAGTXZWFjowdktMXCZtduTTr6qB6pDO3VMzmwXt Nhhh8Cys5qUfSCpeS/qFT3yyz+qxxjueKcktBDTQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Jonathan Cameron Subject: [PATCH 5.3 054/112] iio: adc: axp288: Override TS pin bias current for some models Date: Wed, 16 Oct 2019 14:50:46 -0700 Message-Id: <20191016214858.785104463@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016214844.038848564@linuxfoundation.org> References: <20191016214844.038848564@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede commit 972917419a0ba25afbf69d5d8c9fa644d676f887 upstream. Since commit 9bcf15f75cac ("iio: adc: axp288: Fix TS-pin handling") we preserve the bias current set by the firmware at boot. This fixes issues we were seeing on various models, but it seems our old hardcoded 80ųA bias current was working around a firmware bug on at least one model laptop. In order to both have our cake and eat it, this commit adds a dmi based list of models where we need to override the firmware set bias current and adds the one model we now know needs this to it: The Lenovo Ideapad 100S (11 inch version). Fixes: 9bcf15f75cac ("iio: adc: axp288: Fix TS-pin handling") BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=203829 Signed-off-by: Hans de Goede Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/adc/axp288_adc.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) --- a/drivers/iio/adc/axp288_adc.c +++ b/drivers/iio/adc/axp288_adc.c @@ -7,6 +7,7 @@ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +#include #include #include #include @@ -25,6 +26,11 @@ #define AXP288_ADC_EN_MASK 0xF0 #define AXP288_ADC_TS_ENABLE 0x01 +#define AXP288_ADC_TS_BIAS_MASK GENMASK(5, 4) +#define AXP288_ADC_TS_BIAS_20UA (0 << 4) +#define AXP288_ADC_TS_BIAS_40UA (1 << 4) +#define AXP288_ADC_TS_BIAS_60UA (2 << 4) +#define AXP288_ADC_TS_BIAS_80UA (3 << 4) #define AXP288_ADC_TS_CURRENT_ON_OFF_MASK GENMASK(1, 0) #define AXP288_ADC_TS_CURRENT_OFF (0 << 0) #define AXP288_ADC_TS_CURRENT_ON_WHEN_CHARGING (1 << 0) @@ -177,10 +183,36 @@ static int axp288_adc_read_raw(struct ii return ret; } +/* + * We rely on the machine's firmware to correctly setup the TS pin bias current + * at boot. This lists systems with broken fw where we need to set it ourselves. + */ +static const struct dmi_system_id axp288_adc_ts_bias_override[] = { + { + /* Lenovo Ideapad 100S (11 inch) */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad 100S-11IBY"), + }, + .driver_data = (void *)(uintptr_t)AXP288_ADC_TS_BIAS_80UA, + }, + {} +}; + static int axp288_adc_initialize(struct axp288_adc_info *info) { + const struct dmi_system_id *bias_override; int ret, adc_enable_val; + bias_override = dmi_first_match(axp288_adc_ts_bias_override); + if (bias_override) { + ret = regmap_update_bits(info->regmap, AXP288_ADC_TS_PIN_CTRL, + AXP288_ADC_TS_BIAS_MASK, + (uintptr_t)bias_override->driver_data); + if (ret) + return ret; + } + /* * Determine if the TS pin is enabled and set the TS current-source * accordingly.