Re: [PATCH v4] thermal: add Intel BXT WhiskeyCove PMIC thermal driver

2016-08-26 Thread kbuild test robot
Hi Yegnesh,

[auto build test ERROR on v4.8-rc3]
[also build test ERROR on next-20160825]
[cannot apply to thermal/next soc-thermal/next]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Bin-Gao/thermal-add-Intel-BXT-WhiskeyCove-PMIC-thermal-driver/20160827-050756
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/thermal/intel_bxt_pmic_thermal: struct platform_device_id is 24 
bytes.  The last of 1 is:
   0x62 0x78 0x74 0x5f 0x77 0x63 0x6f 0x76 0x65 0x5f 0x74 0x68 0x65 0x72 0x6d 
0x61 0x6c 0x00 0x00 0x00 0x74 0x00 0x00 0x00 
>> FATAL: drivers/thermal/intel_bxt_pmic_thermal: struct platform_device_id is 
>> not terminated with a NULL entry!

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


[PATCH v4] thermal: add Intel BXT WhiskeyCove PMIC thermal driver

2016-08-26 Thread Bin Gao
From: Yegnesh S Iyer 

thermal: add Intel BXT Whiskey Cove PMIC thermal driver

This change adds support for Intel BXT Whiskey Cove PMIC thermal
driver which is intended to handle the alert interrupts triggered
upon thermal trip point cross and notify the thermal framework
appropriately with the zone, temp, crossed trip and event details.

Signed-off-by: Yegnesh S Iyer 
Signed-off-by: Bin Gao 
---
Changes in v4:
 - Fixed copyright year and changed GPL to GPL v2
Changes in v3:
 - Moved driver data from mfd domain to the driver
 - Minor coding style related cleanup
Changes in v2:
 - Removed unnecessary request_threaded_irq() - we should be only
   using devm_request_threaded_irq() with virq
 drivers/thermal/Kconfig  |  10 ++
 drivers/thermal/Makefile |   1 +
 drivers/thermal/intel_bxt_pmic_thermal.c | 299 +++
 3 files changed, 310 insertions(+)
 create mode 100644 drivers/thermal/intel_bxt_pmic_thermal.c

diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 2d702ca..9bdd624 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -332,6 +332,16 @@ menu "ACPI INT340X thermal drivers"
 source drivers/thermal/int340x_thermal/Kconfig
 endmenu
 
+config INTEL_BXT_PMIC_THERMAL
+   tristate "Intel Broxton PMIC thermal driver"
+   depends on X86 && INTEL_SOC_PMIC && REGMAP
+   help
+ Select this driver for Intel Broxton PMIC with ADC channels monitoring
+ system temperature measurements and alerts.
+ This driver is used for monitoring the ADC channels of PMIC and 
handles
+ the alert trip point interrupts and notifies the thermal framework 
with
+ the trip point and temperature details of the zone.
+
 config INTEL_PCH_THERMAL
tristate "Intel PCH Thermal Reporting Driver"
depends on X86 && PCI
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index 10b07c1..7aa7f4c 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -45,6 +45,7 @@ obj-$(CONFIG_INTEL_SOC_DTS_THERMAL)   += 
intel_soc_dts_thermal.o
 obj-$(CONFIG_INTEL_QUARK_DTS_THERMAL)  += intel_quark_dts_thermal.o
 obj-$(CONFIG_TI_SOC_THERMAL)   += ti-soc-thermal/
 obj-$(CONFIG_INT340X_THERMAL)  += int340x_thermal/
+obj-$(CONFIG_INTEL_BXT_PMIC_THERMAL) += intel_bxt_pmic_thermal.o
 obj-$(CONFIG_INTEL_PCH_THERMAL)+= intel_pch_thermal.o
 obj-$(CONFIG_ST_THERMAL)   += st/
 obj-$(CONFIG_TEGRA_SOCTHERM)   += tegra/
diff --git a/drivers/thermal/intel_bxt_pmic_thermal.c 
b/drivers/thermal/intel_bxt_pmic_thermal.c
new file mode 100644
index 000..dd175c0
--- /dev/null
+++ b/drivers/thermal/intel_bxt_pmic_thermal.c
@@ -0,0 +1,299 @@
+/*
+ * Intel Broxton PMIC thermal driver
+ *
+ * Copyright (C) 2016 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version
+ * 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define BXTWC_THRM0IRQ 0x4E04
+#define BXTWC_THRM1IRQ 0x4E05
+#define BXTWC_THRM2IRQ 0x4E06
+#define BXTWC_MTHRM0IRQ0x4E12
+#define BXTWC_MTHRM1IRQ0x4E13
+#define BXTWC_MTHRM2IRQ0x4E14
+#define BXTWC_STHRM0IRQ0x4F19
+#define BXTWC_STHRM1IRQ0x4F1A
+#define BXTWC_STHRM2IRQ0x4F1B
+
+struct trip_config_map {
+   u16 irq_reg;
+   u16 irq_en;
+   u16 evt_stat;
+   u8 irq_mask;
+   u8 irq_en_mask;
+   u8 evt_mask;
+   u8 trip_num;
+};
+
+struct thermal_irq_map {
+   char handle[20];
+   int num_trips;
+   struct trip_config_map *trip_config;
+};
+
+struct pmic_thermal_data {
+   struct thermal_irq_map *maps;
+   int num_maps;
+};
+
+static struct trip_config_map bxtwc_str0_trip_config[] = {
+   {
+   .irq_reg = BXTWC_THRM0IRQ,
+   .irq_mask = 0x01,
+   .irq_en = BXTWC_MTHRM0IRQ,
+   .irq_en_mask = 0x01,
+   .evt_stat = BXTWC_STHRM0IRQ,
+   .evt_mask = 0x01,
+   .trip_num = 0
+   },
+   {
+   .irq_reg = BXTWC_THRM0IRQ,
+   .irq_mask = 0x10,
+   .irq_en = BXTWC_MTHRM0IRQ,
+   .irq_en_mask = 0x10,
+   .evt_stat = BXTWC_STHRM0IRQ,
+   .evt_mask = 0x10,
+   .trip_num = 1
+   }
+};
+
+static struct trip_config_map bxtwc_str1_trip_config[] = {
+   {
+   .irq_reg = BXTWC_THRM0IRQ,
+   .irq_mask = 0x02,
+   .i