Power: add an API to log wakeup reasons

Add API log_wakeup_reason() and expose it to userspace via sysfs path
/sys/kernel/wakeup_reasons/last_resume_reason

Change-Id: I81addaf420f1338255c5d0638b0d244a99d777d1
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
POWER: fix compile warnings in log_wakeup_reason

Change I81addaf420f1338255c5d0638b0d244a99d777d1 introduced compile
warnings, fix these.

Change-Id: I05482a5335599ab96c0a088a7d175c8d4cf1cf69
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
OMAP4: EMIF: code cleanup and clarification

Removed unused fields of emif_regs structure and
functions that initialize or change them.

Also changed few names of emif_regs members
to match register names.

This made the code easier to understand and read
as well as made it a little bit faster

Change-Id: I0485a01b7f03e922b5a2e69bfb03c2ed941fcf3b
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>
ARM: OMAP4: trim_quirks: Repair the wrong comparison

The omap_rev() returns value not comparable with CHIP_IS_* constants.

Change-Id: I4f21fc84b37f09d1c14c2656bf13337a453d783e
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
Fix mach-omap2/omap-iommu.c to prevent NULL pointer deref and fix a warning.

Change-Id: Iee7790cd529d8823b8c0606a3e4e614e94df0a77
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>
Revert " TI thermal framework: standardize thermal device ops"

This reverts commit 6d7cbe21b307842beb535a9703904f149cd038d4.
Revert "TI thermal framework: Remove unused index"

This reverts commit f1a722c598f12c2f9f299ee0e48a859f97941600.
OMAP4 Thermal Framework: support multiple sensors per domain

Current thermal framework implementation supports 1 temperature
sensor per thermal domain.
The OMAP CPU thermal governor needs to support OMAP and PCB temperature
sensors.
This patch updates the thermal framework to support multiple temperature
sensors per domain.
 - Added temperature report from sensors until at least 1 governor, 1 sensor and
1 cooling device are registered to the thermal framework to have pointers to
temperature sensor initialized at governor level.
 - Updated the thermal framework to allow getting temperature from multiple
temperature sensor and not only the last registered one.

Change-Id: I201ffdeaf3ef18ab17ec84ad8c833b9fc074f4f1
Signed-off-by: Sebastien Sabatier <s-sabatier1@ti.com>

Conflicts:
	drivers/staging/thermal_framework/sensor/omap_temp_sensor.c
	drivers/staging/thermal_framework/sensor/pcb_temp_sensor.c
	drivers/staging/thermal_framework/thermal_framework.c
TI thermal framework: Remove unused index

This patch removes index information as it is never used.

Change-Id: Ic2bfb1677d8fec2cafa7b47626deb432232a0ef6
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>

Conflicts:
	include/linux/thermal_framework.h
TI thermal framework: improve thermal domain manipulations

This patch changes the thermal device data structures
to have a pointer to thermal domain. This way, once
an operation is required on a thermal device, there is
no need to iterate on thermal domains lists.

This patch also centralizes the operations to search and create
thermal domain data structures. Idea is to improve code readability,
having these operations done in one place only.

The patch does not change the code functionality so far.

Change-Id: I482d82feac854270c300273efbef0ef07cdec0b2
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>

Conflicts:
	drivers/staging/thermal_framework/thermal_framework.c
TI thermal framework: release allocated memory for thermal domains

Upon module exit, release all memory allocated on thermal domains.

Change-Id: I74640cc9a9b74dd9cd0a62253ca2444bd00ac31b
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
TI thermal framework: No need to return on end of void functions

Remove unnecessary return at the end of void functions

Change-Id: I6e53e8c1d7b7d33e867b836013a0fecb3f38a3c1
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
TI thermal framework: standardize thermal device ops

This patch changes the .process_temp callback of governor
type of thermal devices. The aim is to make all callbacks
standard. Now, all callbacks receive as first parameter
the affected thermal device.

Change-Id: I9857146e852a7f7d6ac502d044b7f104aa7eb466
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
TI thermal framework: introduce thermal_device_call helper macro

This patch adds a helper macro to call thermal device callback
functions. It will include some pointer checks before calling
the callback. In case the pointer checks fails, it will return
-EOPNOTSUPP, otherwise the callback return value.

The patch also improves the thermal framework core code by
using this helper macro.

Change-Id: I7db80271ec2509eb14670ae04532cff06cdf002c
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
TI thermal framework: remove unnecessary checks on thermal domain list

The domain can be fetch from each thermal device. Because of that,
there is no need to check for the emptiness of thermal domain list.

Change-Id: I786b82f6353711c376bcfcb24d0cca5eeb96a8d3
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
TI thermal framework: avoid free memory not allocated by the fw

Because the objects passed to the thermal framework are already
allocated, it does not make sense to free them inside the thermal
framework. This patch removes all memory release calls to memory
areas not owned by the thermal framework.

Change-Id: Ie49e99b7f6285cf435f5eab7ad26a61257ed86df
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
TI thermal framework: add helper macro to call ops on several thermal devices

This patch introduces a helper macro to execute same callback of several
thermal devices, linked by a list. It will attempt to reach all devices,
even if some of them are missing the callback or if the callback is
returning error values.

Because of the introduction of this helper, there is no need to have
a specific function to set the cooling level on a list of cooling devices.

Change-Id: I430a885400c17b81e98736c9a0ca1b675493b610
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
TI thermal framework: translate sensor helper functions into macro helpers

This patch removes helper functions operations that can be resolved by
the existing helper macros.

Change-Id: I11c8d2efc45c14bacffcddac944afddbc456e3e0
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>

Conflicts:
	drivers/staging/thermal_framework/governor/omap_die_governor.c
TI thermal framework: set temperature when domain is ready

Instead of reading domain temperature when a domain is ready,
this patch changes the flow to set the temperature. Now,
the temperature will be report to the governor when its domain
is ready with all needed pieces: sensor, governor, cooling agents.

Change-Id: I680bd6ff535dbe452d7b6cb9562594fa37826148
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
TI thermal framework: introduce thermal_lookup_temp function

This patch adds a helper function to get temperature of
a thermal domain, based on the domain name.

It will perform a domain name lookup and use its thermal
sensor device to fetch the temperature. If the domain
is not ready to report temperature, it will return an
error code.

Change-Id: I55d173c686e61650cb3a18ff4ae434711f2ebf37
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>