From patchwork Thu Jun 28 15:08:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 141550 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2304302ljj; Thu, 28 Jun 2018 08:09:34 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJbtIFH9SeMu1JSWONg3fQ4yDQzZvdS4nJEl6fr26fdVSfVtg3HIhQDgmVMlxDxguCMAD2V X-Received: by 2002:a17:902:b589:: with SMTP id a9-v6mr11001593pls.140.1530198574220; Thu, 28 Jun 2018 08:09:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530198574; cv=none; d=google.com; s=arc-20160816; b=FmIwPBAz8+g4N50upyWijKFMrzu7UKXSZgkwpe1NWvaiQ6DiIafB1toEi+k8ydsFiQ 9wJFWq6slh6XPwd7i3yoXaTjaW/HARy/k4mB5ZUien9kyYgKrGxWK7Uh2+UPMPbRq/vu 2uLDlpyWnyis4x2jprErVKwJTEhI2bQBhVx6q6E+UKKNYp/+L400czYEjpJ1J12JFwlH x0BYQMGZHtVo7AgOYkH7XdsOsvw7cNRP+UW6X2Avgo6Ni49me0Kh365cBedTCF02xpj9 kKfAZwT0LPL/0W6U32VGtWdcDQ6EtGRiDgQwsb3Uqwur+Uhoc3mdJtIYanJuYfziYJIA K82A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=89f8VAf9G5wBUCNb19uxhc/MUSlz6uB1Q4psLy13zZs=; b=mJzmi4IXo0zQ5wDcgEzUBowI7tSlcnJpt1AnuAcioLlCdz89XhfuFUXlT5w6cKOizp gVwNHb0DPF0dMH0vrCvoofowJs0Ox76Q+q0URdtzjHYZ2H0X15E6GMAOlSJlLPrjaoYq OsVPUFExwaKwC7i0xSU2rex1zG0VsoKwvdDYLIkBkkb9aadFQ/UJvlJqRWb5mv464Aah TkEnO4coTaAG1rfNYFzue0P5S1B7M2QqDeoEA2CLXxkiGGt+UiKgZSTmLdAFChosbCl7 zWLMh/8OSmr6gFUqAZCcj+dn0WYzmyFmPQWX/cFPQC7xS+gbJLKaWURKrlY5ux+n5vok uyrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=default header.b=Ov60k+DD; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g65-v6si7038647pfc.330.2018.06.28.08.09.34; Thu, 28 Jun 2018 08:09:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=default header.b=Ov60k+DD; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967013AbeF1PJc (ORCPT + 5 others); Thu, 28 Jun 2018 11:09:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:37734 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966685AbeF1PJa (ORCPT ); Thu, 28 Jun 2018 11:09:30 -0400 Received: from localhost.localdomain (unknown [106.201.104.231]) (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 9E8612759C; Thu, 28 Jun 2018 15:09:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1530198570; bh=fq5pRvv7l2RdVMoGeMRUCw4CKuyjgbrAh7ugw5EqUG4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ov60k+DDPRE9GxL8cv0KRYBgbYDB9mq5HS1J4nmjFqZUlLwwz0U/Sf0ra3S3UB3tp 6DXAOXfv+dcF2Z0rHMddG7vVsRBm7alSDBRBCy9RAIMw3+KLlSqmZ1WymiYT7I7er+ ONglNZYZfgmlV2zKJuDgJhfgAyytUKsNAZ5DSWhk= From: Vinod Koul To: linux-input@vger.kernel.org, linux-pm@vger.kernel.org Cc: Bjorn Andersson , Dmitry Torokhov , Rob Herring , Sebastian Reichel , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vinod Koul Subject: [PATCH v5 2/6] power: reset: qcom-pon: Add Qcom PON driver Date: Thu, 28 Jun 2018 20:38:46 +0530 Message-Id: <20180628150850.15358-3-vkoul@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180628150850.15358-1-vkoul@kernel.org> References: <20180628150850.15358-1-vkoul@kernel.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add support Qualcomm PM8xxx PON which is responsible for reboot mode support. Co-developed-by: Bjorn Andersson Signed-off-by: Bjorn Andersson Signed-off-by: Vinod Koul --- drivers/power/reset/Kconfig | 11 +++++ drivers/power/reset/Makefile | 1 + drivers/power/reset/qcom-pon.c | 91 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+) create mode 100644 drivers/power/reset/qcom-pon.c -- 2.14.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig index df58fc878b3e..6533aa560aa1 100644 --- a/drivers/power/reset/Kconfig +++ b/drivers/power/reset/Kconfig @@ -104,6 +104,17 @@ config POWER_RESET_MSM help Power off and restart support for Qualcomm boards. +config POWER_RESET_QCOM_PON + tristate "Qualcomm power-on driver" + depends on ARCH_QCOM + depends on MFD_SPMI_PMIC + select REBOOT_MODE + help + Power On support for Qualcomm boards. + If you have a Qualcomm platform and need support for + power-on and reboot reason, Say Y. + If unsure, Say N. + config POWER_RESET_OCELOT_RESET bool "Microsemi Ocelot reset driver" depends on MSCC_OCELOT || COMPILE_TEST diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile index 7778c7485cf1..0aebee954ac1 100644 --- a/drivers/power/reset/Makefile +++ b/drivers/power/reset/Makefile @@ -11,6 +11,7 @@ obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o obj-$(CONFIG_POWER_RESET_GPIO_RESTART) += gpio-restart.o obj-$(CONFIG_POWER_RESET_HISI) += hisi-reboot.o obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o +obj-$(CONFIG_POWER_RESET_QCOM_PON) += qcom-pon.o obj-$(CONFIG_POWER_RESET_OCELOT_RESET) += ocelot-reset.o obj-$(CONFIG_POWER_RESET_PIIX4_POWEROFF) += piix4-poweroff.o obj-$(CONFIG_POWER_RESET_LTC2952) += ltc2952-poweroff.o diff --git a/drivers/power/reset/qcom-pon.c b/drivers/power/reset/qcom-pon.c new file mode 100644 index 000000000000..0c4caaa7e88f --- /dev/null +++ b/drivers/power/reset/qcom-pon.c @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (c) 2017-18 Linaro Limited + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define PON_SOFT_RB_SPARE 0x8f + +struct pm8916_pon { + struct device *dev; + struct regmap *regmap; + u32 baseaddr; + struct reboot_mode_driver reboot_mode; +}; + +static int pm8916_reboot_mode_write(struct reboot_mode_driver *reboot, + unsigned int magic) +{ + struct pm8916_pon *pon = container_of + (reboot, struct pm8916_pon, reboot_mode); + int ret; + + ret = regmap_update_bits(pon->regmap, + pon->baseaddr + PON_SOFT_RB_SPARE, + 0xfc, magic << 2); + if (ret < 0) + dev_err(pon->dev, "update reboot mode bits failed\n"); + + return ret; +} + +static int pm8916_pon_probe(struct platform_device *pdev) +{ + struct pm8916_pon *pon; + int error; + + pon = devm_kzalloc(&pdev->dev, sizeof(*pon), GFP_KERNEL); + if (!pon) + return -ENOMEM; + + pon->dev = &pdev->dev; + + pon->regmap = dev_get_regmap(pdev->dev.parent, NULL); + if (!pon->regmap) { + dev_err(&pdev->dev, "failed to locate regmap\n"); + return -ENODEV; + } + + error = of_property_read_u32(pdev->dev.of_node, "reg", + &pon->baseaddr); + if (error) + return error; + + pon->reboot_mode.dev = &pdev->dev; + pon->reboot_mode.write = pm8916_reboot_mode_write; + error = devm_reboot_mode_register(&pdev->dev, &pon->reboot_mode); + if (error) { + dev_err(&pdev->dev, "can't register reboot mode\n"); + return error; + } + + platform_set_drvdata(pdev, pon); + + return devm_of_platform_populate(&pdev->dev); +} + +static const struct of_device_id pm8916_pon_id_table[] = { + { .compatible = "qcom,pm8916-pon" }, + { } +}; +MODULE_DEVICE_TABLE(of, pm8916_pon_id_table); + +static struct platform_driver pm8916_pon_driver = { + .probe = pm8916_pon_probe, + .driver = { + .name = "pm8916-pon", + .of_match_table = of_match_ptr(pm8916_pon_id_table), + }, +}; +module_platform_driver(pm8916_pon_driver); + +MODULE_DESCRIPTION("pm8916 Power On driver"); +MODULE_LICENSE("GPL v2"); From patchwork Thu Jun 28 15:08:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 141547 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2304374ljj; Thu, 28 Jun 2018 08:09:37 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLt0Tw28Emu6KRX7r0TnQmCYc+Lik51Y2F6DhhnmKTXG3X6ScnS97Uue7+Br2CfMmqhANOw X-Received: by 2002:a17:902:622:: with SMTP id 31-v6mr10761206plg.135.1530198577638; Thu, 28 Jun 2018 08:09:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530198577; cv=none; d=google.com; s=arc-20160816; b=JysM46EldLImRQ5nBl1tzg/+L4kD5u7Im13UY5SWAVJi55Di+183RQbj1Op0gk/DUB ufu8IB4Buhs9uz1WGQLlBra1NS8TqE3C9I/G6tAPpOpmBdZDjjA3VgawEXSKskhvVAxv fRWqbrG7Od5QAT4YaPsiAiI5DssStMxBsTunca7aJlN9U3I5W0xo4ZPnqeafVvYROOdS XwGSy6G1vZurRZO7MGmgIhgpTZmBZ1uWxMKmYwvgYKz01goU9/ub6hyR7KMpnR54pNMC Y6jg3hJxguM4m6w1zEH2D5VxfLHsIQMuXN56njX3iNc8Biz1hCg/qBvwP/B1temAZJK1 TsDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=Clz6jJdGqgufTWeJ35CfOdHweyJyDGVTcaiLcEiZw9E=; b=YA8tXt2DkMo/PWygH/UF2eiZ/vQDcqTZuVdWVkQEq6Vfn6tBGR/I1QMRGhpwQfC+Pi R/X1I4DyAvFo1A61bz580uxyxmkx06kwrWvu8btkDsRwSsM3HFtZlHnjlY/Db9Vp3N+m bkQRFArN/5UXiqd5r/enRvi0wEta6EgQw/Aqq7mCfYiNP4rMrVySIa4RRnY8+yRnbnKv mL8WYyYRQfeFWZ4BjLZkLAf8NA0TlNOYV159IidcxvSTHw0HskZzRnoNg2UABq8q0zCw INWbxOYwTIlAQlW0lO46tv+oL4toG4ESb+C2EavECZr3m8lTjzPFfhg2SAMyWBFui6wk LYVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=default header.b=w3ZEEW7s; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f14-v6si6681332plr.365.2018.06.28.08.09.37; Thu, 28 Jun 2018 08:09:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=default header.b=w3ZEEW7s; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967018AbeF1PJf (ORCPT + 5 others); Thu, 28 Jun 2018 11:09:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:37796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966685AbeF1PJd (ORCPT ); Thu, 28 Jun 2018 11:09:33 -0400 Received: from localhost.localdomain (unknown [106.201.104.231]) (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 9006124832; Thu, 28 Jun 2018 15:09:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1530198573; bh=OGhovl5BzeNCmQad07iM1uFwQ1SKszETGbpWsIjfBqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w3ZEEW7sVErHuhCTr7xCAJb1Jy50ssFsmIZRxl9n17jvkI0Lb6jb3ZJEZffa1kZLm ME3xj9th4nvPWqC1TMObpRsbFItH7PS7qt3FSPFIQevl+sRl4+1dQ7XiNHCYRL/kT/ ILgqGJt6q4Lhc//y+/ZYT8qoOsZ5DpkHU4AU4L6I= From: Vinod Koul To: linux-input@vger.kernel.org, linux-pm@vger.kernel.org Cc: Bjorn Andersson , Dmitry Torokhov , Rob Herring , Sebastian Reichel , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vinod Koul Subject: [PATCH v5 3/6] dt-bindings: Input: Add additional property to qcom pwrkey Date: Thu, 28 Jun 2018 20:38:47 +0530 Message-Id: <20180628150850.15358-4-vkoul@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180628150850.15358-1-vkoul@kernel.org> References: <20180628150850.15358-1-vkoul@kernel.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Pwrkey and reset have similar properties so add additional property for linux,code to use the code for sending events. Reviewed-by: Bjorn Andersson Reviewed-by: Rob Herring Signed-off-by: Vinod Koul --- Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.14.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt index 07bf55f6e0b9..bf719396eadd 100644 --- a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt +++ b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt @@ -32,6 +32,14 @@ PROPERTIES Definition: presence of this property indicates that the KPDPWR_N pin should be configured for pull up. +- linux,code: + Usage: optional + Value type: + Definition: The input key-code associated with the power key. + Use the linux event codes defined in + include/dt-bindings/input/linux-event-codes.h + When property is omitted KEY_POWER is assumed. + EXAMPLE pwrkey@800 { @@ -40,4 +48,5 @@ EXAMPLE interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>; debounce = <15625>; bias-pull-up; + linux,code = ; };