From patchwork Fri Feb 15 12:44:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 14857 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 56D6A23E2E for ; Fri, 15 Feb 2013 12:46:15 +0000 (UTC) Received: from mail-vb0-f47.google.com (mail-vb0-f47.google.com [209.85.212.47]) by fiordland.canonical.com (Postfix) with ESMTP id 11499A18025 for ; Fri, 15 Feb 2013 12:46:14 +0000 (UTC) Received: by mail-vb0-f47.google.com with SMTP id e21so2114477vbm.34 for ; Fri, 15 Feb 2013 04:46:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=XQ/WuiCf+DPKrgJ81BBSrBM1rDlBnSoZcDBNVM3k7jg=; b=gj6fvVrq3BgYZpA1uB29YdaihwLDkwYMBO+4lOffGuREdZF//Z2RwdMMflZq/GOG/X 9F5pv1JJMgjRXo1K7jy0+7cS478HGFO6ItWFj68AXHwwkuAwIwGmnr9DMsVRX5R/z7RI HTaR8w/J3zJX7mpaB87oGFx4tUMmvkWVemWEGG+Zy5QrbZuS6UuzUXDjzSXKZx62YraH 2cw6EcouRjksO7eqdu1+IvvWUxWC764UBBd8yr3arXVGmykoSXIJFyHJ/vuBZM70MH4j WNulBVjy5/PZgnyzdkgkCuLjqXDl8D0tNDJ/wDGtZ26RMjLKI/R9eKhdjdapsgZNDjPX 0b0A== X-Received: by 10.58.186.241 with SMTP id fn17mr3019408vec.8.1360932374536; Fri, 15 Feb 2013 04:46:14 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.221.4.5 with SMTP id oa5csp10847vcb; Fri, 15 Feb 2013 04:46:13 -0800 (PST) X-Received: by 10.180.93.234 with SMTP id cx10mr5625695wib.34.1360932373163; Fri, 15 Feb 2013 04:46:13 -0800 (PST) Received: from mail-we0-x22c.google.com ([2a00:1450:400c:c03::22c]) by mx.google.com with ESMTPS id dm5si1029212wib.120.2013.02.15.04.46.12 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Feb 2013 04:46:13 -0800 (PST) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::22c is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c03::22c; Authentication-Results: mx.google.com; spf=neutral (google.com: 2a00:1450:400c:c03::22c is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-we0-f172.google.com with SMTP id x10so2825514wey.31 for ; Fri, 15 Feb 2013 04:46:12 -0800 (PST) X-Received: by 10.194.77.129 with SMTP id s1mr4039335wjw.17.1360932372765; Fri, 15 Feb 2013 04:46:12 -0800 (PST) Received: from localhost.localdomain (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPS id bs6sm5133904wib.4.2013.02.15.04.46.10 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Feb 2013 04:46:11 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, linus.walleij@stericsson.com, cbouatmailru@gmail.com, sameo@linux.intel.com, Rupesh Kumar , Lee Jones Subject: [PATCH 14/40] pm2301-charger: Die temp thermal protection Date: Fri, 15 Feb 2013 12:44:44 +0000 Message-Id: <1360932310-30065-15-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1360932310-30065-1-git-send-email-lee.jones@linaro.org> References: <1360932310-30065-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQnczQsLopSfpj/Mr3zpOEyIwfhLX3ljTQFMoSPNuBdmZ/f9tAswqqHwp6i1feVwi8pCqZAL From: Rupesh Kumar This patch adds support for die temperature thermal protection in pm2301 driver. Signed-off-by: Rupesh Kumar Signed-off-by: Lee Jones Reviewed-by: Hakan BERG Reviewed-by: Philippe LANGLAIS --- drivers/power/pm2301_charger.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/power/pm2301_charger.c b/drivers/power/pm2301_charger.c index 4cb8f7f..ec51026 100644 --- a/drivers/power/pm2301_charger.c +++ b/drivers/power/pm2301_charger.c @@ -876,7 +876,27 @@ static void pm2xxx_charger_check_hw_failure_work(struct work_struct *work) static void pm2xxx_charger_check_main_thermal_prot_work( struct work_struct *work) { -}; + int ret; + u8 val; + + struct pm2xxx_charger *pm2 = container_of(work, struct pm2xxx_charger, + check_main_thermal_prot_work); + + /* Check if die temp warning is still active */ + ret = pm2xxx_reg_read(pm2, PM2XXX_SRCE_REG_INT5, &val); + if (ret < 0) { + dev_err(pm2->dev, "%s pm2xxx read failed\n", __func__); + return; + } + if (val & (PM2XXX_INT5_S_ITTHERMALWARNINGRISE + | PM2XXX_INT5_S_ITTHERMALSHUTDOWNRISE)) + pm2->flags.main_thermal_prot = true; + else if (val & (PM2XXX_INT5_S_ITTHERMALWARNINGFALL + | PM2XXX_INT5_S_ITTHERMALSHUTDOWNFALL)) + pm2->flags.main_thermal_prot = false; + + power_supply_changed(&pm2->ac_chg.psy); +} static struct pm2xxx_interrupts pm2xxx_int = { .handler[0] = pm2_int_reg0,