* [PATCH 0/4] MRST/Medfield thermal updates
@ 2011-12-15 22:27 Alan Cox
2011-12-15 22:27 ` [PATCH 1/4] platform-x86: intel_mid_thermal: add msic_thermal alias Alan Cox
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Alan Cox @ 2011-12-15 22:27 UTC (permalink / raw)
To: mjg, platform-driver-x86
Update the thermal driver to use the MSIC MFD layer, and make sure we turn
off the thermistor by default
---
Mika Westerberg (4):
x86, mrst: add msic_thermal platform support
platform-x86: intel_mid_thermal: turn off thermistor voltage by default
platform-x86: intel_mid_thermal: convert to use Intel MSIC API
platform-x86: intel_mid_thermal: add msic_thermal alias
arch/x86/platform/mrst/mrst.c | 6 ++++
drivers/platform/x86/Kconfig | 2 +
drivers/platform/x86/intel_mid_thermal.c | 46 +++++++++++++++---------------
3 files changed, 30 insertions(+), 24 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] platform-x86: intel_mid_thermal: add msic_thermal alias
2011-12-15 22:27 [PATCH 0/4] MRST/Medfield thermal updates Alan Cox
@ 2011-12-15 22:27 ` Alan Cox
2011-12-15 22:28 ` [PATCH 2/4] platform-x86: intel_mid_thermal: convert to use Intel MSIC API Alan Cox
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Alan Cox @ 2011-12-15 22:27 UTC (permalink / raw)
To: mjg, platform-driver-x86
From: Mika Westerberg <mika.westerberg@linux.intel.com>
In newer boards this device is called "msic_thermal" instead of
"msic_sensor". To support both we add suitable alias for the driver.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/platform/x86/intel_mid_thermal.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/platform/x86/intel_mid_thermal.c b/drivers/platform/x86/intel_mid_thermal.c
index ccd7b1f..de2e62e 100644
--- a/drivers/platform/x86/intel_mid_thermal.c
+++ b/drivers/platform/x86/intel_mid_thermal.c
@@ -550,6 +550,7 @@ static int mid_thermal_remove(struct platform_device *pdev)
static const struct platform_device_id therm_id_table[] = {
{ DRIVER_NAME, 1 },
+ { "msic_thermal", 1 },
{ }
};
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] platform-x86: intel_mid_thermal: convert to use Intel MSIC API
2011-12-15 22:27 [PATCH 0/4] MRST/Medfield thermal updates Alan Cox
2011-12-15 22:27 ` [PATCH 1/4] platform-x86: intel_mid_thermal: add msic_thermal alias Alan Cox
@ 2011-12-15 22:28 ` Alan Cox
2011-12-15 22:28 ` [PATCH 3/4] platform-x86: intel_mid_thermal: turn off thermistor voltage by default Alan Cox
2011-12-15 22:28 ` [PATCH 4/4] x86, mrst: add msic_thermal platform support Alan Cox
3 siblings, 0 replies; 5+ messages in thread
From: Alan Cox @ 2011-12-15 22:28 UTC (permalink / raw)
To: mjg, platform-driver-x86
From: Mika Westerberg <mika.westerberg@linux.intel.com>
Intel MSIC MFD driver provides common register access interface to the
devices in the MSIC die so we use that instead of SCU IPC.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/platform/x86/Kconfig | 2 +-
drivers/platform/x86/intel_mid_thermal.c | 39 ++++++++++++++----------------
2 files changed, 19 insertions(+), 22 deletions(-)
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index f995e6e..7c03c4c 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -672,7 +672,7 @@ config INTEL_MID_POWER_BUTTON
config INTEL_MFLD_THERMAL
tristate "Thermal driver for Intel Medfield platform"
- depends on INTEL_SCU_IPC && THERMAL
+ depends on MFD_INTEL_MSIC && THERMAL
help
Say Y here to enable thermal driver support for the Intel Medfield
platform.
diff --git a/drivers/platform/x86/intel_mid_thermal.c b/drivers/platform/x86/intel_mid_thermal.c
index de2e62e..aef4979 100644
--- a/drivers/platform/x86/intel_mid_thermal.c
+++ b/drivers/platform/x86/intel_mid_thermal.c
@@ -33,18 +33,15 @@
#include <linux/slab.h>
#include <linux/pm.h>
#include <linux/thermal.h>
-
-#include <asm/intel_scu_ipc.h>
+#include <linux/mfd/intel_msic.h>
/* Number of thermal sensors */
#define MSIC_THERMAL_SENSORS 4
/* ADC1 - thermal registers */
-#define MSIC_THERM_ADC1CNTL1 0x1C0
#define MSIC_ADC_ENBL 0x10
#define MSIC_ADC_START 0x08
-#define MSIC_THERM_ADC1CNTL3 0x1C2
#define MSIC_ADCTHERM_ENBL 0x04
#define MSIC_ADCRRDATA_ENBL 0x05
#define MSIC_CHANL_MASK_VAL 0x0F
@@ -75,8 +72,8 @@
#define ADC_VAL60C 315
/* ADC base addresses */
-#define ADC_CHNL_START_ADDR 0x1C5 /* increments by 1 */
-#define ADC_DATA_START_ADDR 0x1D4 /* increments by 2 */
+#define ADC_CHNL_START_ADDR INTEL_MSIC_ADC1ADDR0 /* increments by 1 */
+#define ADC_DATA_START_ADDR INTEL_MSIC_ADC1SNS0H /* increments by 2 */
/* MSIC die attributes */
#define MSIC_DIE_ADC_MIN 488
@@ -189,17 +186,17 @@ static int mid_read_temp(struct thermal_zone_device *tzd, unsigned long *temp)
addr = td_info->chnl_addr;
/* Enable the msic for conversion before reading */
- ret = intel_scu_ipc_iowrite8(MSIC_THERM_ADC1CNTL3, MSIC_ADCRRDATA_ENBL);
+ ret = intel_msic_reg_write(INTEL_MSIC_ADC1CNTL3, MSIC_ADCRRDATA_ENBL);
if (ret)
return ret;
/* Re-toggle the RRDATARD bit (temporary workaround) */
- ret = intel_scu_ipc_iowrite8(MSIC_THERM_ADC1CNTL3, MSIC_ADCTHERM_ENBL);
+ ret = intel_msic_reg_write(INTEL_MSIC_ADC1CNTL3, MSIC_ADCTHERM_ENBL);
if (ret)
return ret;
/* Read the higher bits of data */
- ret = intel_scu_ipc_ioread8(addr, &data);
+ ret = intel_msic_reg_read(addr, &data);
if (ret)
return ret;
@@ -207,7 +204,7 @@ static int mid_read_temp(struct thermal_zone_device *tzd, unsigned long *temp)
adc_val = (data << 2);
addr++;
- ret = intel_scu_ipc_ioread8(addr, &data);/* Read lower bits */
+ ret = intel_msic_reg_read(addr, &data);/* Read lower bits */
if (ret)
return ret;
@@ -235,7 +232,7 @@ static int configure_adc(int val)
int ret;
uint8_t data;
- ret = intel_scu_ipc_ioread8(MSIC_THERM_ADC1CNTL1, &data);
+ ret = intel_msic_reg_read(INTEL_MSIC_ADC1CNTL1, &data);
if (ret)
return ret;
@@ -246,7 +243,7 @@ static int configure_adc(int val)
/* Just stop the ADC */
data &= (~MSIC_ADC_START);
}
- return intel_scu_ipc_iowrite8(MSIC_THERM_ADC1CNTL1, data);
+ return intel_msic_reg_write(INTEL_MSIC_ADC1CNTL1, data);
}
/**
@@ -262,21 +259,21 @@ static int set_up_therm_channel(u16 base_addr)
int ret;
/* Enable all the sensor channels */
- ret = intel_scu_ipc_iowrite8(base_addr, SKIN_SENSOR0_CODE);
+ ret = intel_msic_reg_write(base_addr, SKIN_SENSOR0_CODE);
if (ret)
return ret;
- ret = intel_scu_ipc_iowrite8(base_addr + 1, SKIN_SENSOR1_CODE);
+ ret = intel_msic_reg_write(base_addr + 1, SKIN_SENSOR1_CODE);
if (ret)
return ret;
- ret = intel_scu_ipc_iowrite8(base_addr + 2, SYS_SENSOR_CODE);
+ ret = intel_msic_reg_write(base_addr + 2, SYS_SENSOR_CODE);
if (ret)
return ret;
/* Since this is the last channel, set the stop bit
* to 1 by ORing the DIE_SENSOR_CODE with 0x10 */
- ret = intel_scu_ipc_iowrite8(base_addr + 3,
+ ret = intel_msic_reg_write(base_addr + 3,
(MSIC_DIE_SENSOR_CODE | 0x10));
if (ret)
return ret;
@@ -295,11 +292,11 @@ static int reset_stopbit(uint16_t addr)
{
int ret;
uint8_t data;
- ret = intel_scu_ipc_ioread8(addr, &data);
+ ret = intel_msic_reg_read(addr, &data);
if (ret)
return ret;
/* Set the stop bit to zero */
- return intel_scu_ipc_iowrite8(addr, (data & 0xEF));
+ return intel_msic_reg_write(addr, (data & 0xEF));
}
/**
@@ -322,7 +319,7 @@ static int find_free_channel(void)
uint8_t data;
/* check whether ADC is enabled */
- ret = intel_scu_ipc_ioread8(MSIC_THERM_ADC1CNTL1, &data);
+ ret = intel_msic_reg_read(INTEL_MSIC_ADC1CNTL1, &data);
if (ret)
return ret;
@@ -331,7 +328,7 @@ static int find_free_channel(void)
/* ADC is already enabled; Looking for an empty channel */
for (i = 0; i < ADC_CHANLS_MAX; i++) {
- ret = intel_scu_ipc_ioread8(ADC_CHNL_START_ADDR + i, &data);
+ ret = intel_msic_reg_read(ADC_CHNL_START_ADDR + i, &data);
if (ret)
return ret;
@@ -359,7 +356,7 @@ static int mid_initialize_adc(struct device *dev)
* Ensure that adctherm is disabled before we
* initialize the ADC
*/
- ret = intel_scu_ipc_ioread8(MSIC_THERM_ADC1CNTL3, &data);
+ ret = intel_msic_reg_read(INTEL_MSIC_ADC1CNTL3, &data);
if (ret)
return ret;
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] platform-x86: intel_mid_thermal: turn off thermistor voltage by default
2011-12-15 22:27 [PATCH 0/4] MRST/Medfield thermal updates Alan Cox
2011-12-15 22:27 ` [PATCH 1/4] platform-x86: intel_mid_thermal: add msic_thermal alias Alan Cox
2011-12-15 22:28 ` [PATCH 2/4] platform-x86: intel_mid_thermal: convert to use Intel MSIC API Alan Cox
@ 2011-12-15 22:28 ` Alan Cox
2011-12-15 22:28 ` [PATCH 4/4] x86, mrst: add msic_thermal platform support Alan Cox
3 siblings, 0 replies; 5+ messages in thread
From: Alan Cox @ 2011-12-15 22:28 UTC (permalink / raw)
To: mjg, platform-driver-x86
From: Mika Westerberg <mika.westerberg@linux.intel.com>
Instead of complaining that the voltage is on, we can just ask the MSIC to
turn the voltage off. This should save some power.
Voltage for thermistors is turned on when ADC conversion is initiated.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/platform/x86/intel_mid_thermal.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/intel_mid_thermal.c b/drivers/platform/x86/intel_mid_thermal.c
index aef4979..a4e56be 100644
--- a/drivers/platform/x86/intel_mid_thermal.c
+++ b/drivers/platform/x86/intel_mid_thermal.c
@@ -360,8 +360,10 @@ static int mid_initialize_adc(struct device *dev)
if (ret)
return ret;
- if (data & MSIC_ADCTHERM_MASK)
- dev_warn(dev, "ADCTHERM already set");
+ data &= ~MSIC_ADCTHERM_MASK;
+ ret = intel_msic_reg_write(INTEL_MSIC_ADC1CNTL3, data);
+ if (ret)
+ return ret;
/* Index of the first channel in which the stop bit is set */
channel_index = find_free_channel();
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] x86, mrst: add msic_thermal platform support
2011-12-15 22:27 [PATCH 0/4] MRST/Medfield thermal updates Alan Cox
` (2 preceding siblings ...)
2011-12-15 22:28 ` [PATCH 3/4] platform-x86: intel_mid_thermal: turn off thermistor voltage by default Alan Cox
@ 2011-12-15 22:28 ` Alan Cox
3 siblings, 0 replies; 5+ messages in thread
From: Alan Cox @ 2011-12-15 22:28 UTC (permalink / raw)
To: mjg, platform-driver-x86
From: Mika Westerberg <mika.westerberg@linux.intel.com>
This will let the MSIC driver to create platform device for the thermal
driver.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
arch/x86/platform/mrst/mrst.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c
index 4c2235d..a9a4732 100644
--- a/arch/x86/platform/mrst/mrst.c
+++ b/arch/x86/platform/mrst/mrst.c
@@ -686,6 +686,11 @@ static void *msic_ocd_platform_data(void *info)
return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_OCD);
}
+static void *msic_thermal_platform_data(void *info)
+{
+ return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_THERMAL);
+}
+
static const struct devs_id __initconst device_ids[] = {
{"bma023", SFI_DEV_TYPE_I2C, 1, &no_platform_data},
{"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data},
@@ -705,6 +710,7 @@ static const struct devs_id __initconst device_ids[] = {
{"msic_audio", SFI_DEV_TYPE_IPC, 1, &msic_audio_platform_data},
{"msic_power_btn", SFI_DEV_TYPE_IPC, 1, &msic_power_btn_platform_data},
{"msic_ocd", SFI_DEV_TYPE_IPC, 1, &msic_ocd_platform_data},
+ {"msic_thermal", SFI_DEV_TYPE_IPC, 1, &msic_thermal_platform_data},
{},
};
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-12-15 22:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-15 22:27 [PATCH 0/4] MRST/Medfield thermal updates Alan Cox
2011-12-15 22:27 ` [PATCH 1/4] platform-x86: intel_mid_thermal: add msic_thermal alias Alan Cox
2011-12-15 22:28 ` [PATCH 2/4] platform-x86: intel_mid_thermal: convert to use Intel MSIC API Alan Cox
2011-12-15 22:28 ` [PATCH 3/4] platform-x86: intel_mid_thermal: turn off thermistor voltage by default Alan Cox
2011-12-15 22:28 ` [PATCH 4/4] x86, mrst: add msic_thermal platform support Alan Cox
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.