rtc: pm8xxx: Sync up to upstream version

Changes from upstream code-review during submission weren't
backported. Backport them now.

Change-Id: Id9f3f6316268bf12b9b11e35b18e1866e7cda542
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>

Conflicts:
	drivers/rtc/rtc-pm8xxx.c
drivers: rtc-pm8xxx: Clear alarm register when IRQ is disabled

Based on
https://github.com/CyanogenMod/android_kernel_samsung_d2/commit/0287c9698a6e09fd22aabfc7536d8b503aaa27d4

QCOM never anticipated people turning the RTC on on this class of
devices.

Change-Id: Ia151e1ddb737ed4a3e4c68540f2882285460d8b9
rtc: pm8xxx: move device_init_wakeup() before rtc_register

Setup wakeup capability before rtc_register to ensure the rtc class core
properly sets up our 'wakealarm' sysfs attribute.

Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Conflicts:
	drivers/rtc/rtc-pm8xxx.c
rtc-pm8xxx: fixed for not used AUTO_PWRON config.
REVERT: Custom Faux Cpufreq table for all cores. before updating!

reverting:
https://github.com/dorimanx/Dorimanx-LG-G2-D802-Kernel/commit/58ff858f1a612affb39b6d58930aae69e7ff0e79
https://github.com/dorimanx/Dorimanx-LG-G2-D802-Kernel/commit/d1b63ccab6b35cc6104e72c6a1139f0b84e7d87b
https://github.com/dorimanx/Dorimanx-LG-G2-D802-Kernel/commit/2217ba587948e8aba989c15604e92a97ea4d8a2b
cpufreq / stats: fix race between stats allocation and first usage

This patch forces complete struct cpufreq_stats allocation for all cpus before
registering CPUFREQ_TRANSITION_NOTIFIER notifier, otherwise in some conditions
cpufreq_stat_notifier_trans() can be called in the middle of stats allocation,
in this case cpufreq_stats_table already exists, but stat->freq_table is NULL.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
cpufreq / stats: Get rid of CPUFREQ_STATDEVICE_ATTR

Macro "CPUFREQ_STATDEVICE_ATTR" is defined local to cpufreq_stats.c file and is
almost a copy of the generic version present in cpufreq.h file. Lets use the
generic version instead.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
cpufreq_stats: do not remove sysfs files if frequency table is not present

The sysfs files for cpufreq_stats are created in cpufreq_stats_create_table()
called from cpufreq_stat_notifier_policy() when a policy is added to
the cpu. cpufreq_stats_create_table() will not be called if the
scaling driver does not export a frequency table to cpufreq.  Use the
same fence on tear down.

Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
cpufreq: Preserve sysfs files across suspend/resume

The file permissions of cpufreq per-cpu sysfs files are not preserved
across suspend/resume because we internally go through the CPU
Hotplug path which reinitializes the file permissions on CPU online.

But the user is not supposed to know that we are using CPU hotplug
internally within suspend/resume (IOW, the kernel should not silently
wreck the user-set file permissions across a suspend cycle).
Therefore, we need to preserve the file permissions as they are
across suspend/resume.

The simplest way to achieve that is to just not touch the sysfs files
at all - ie., just ignore the CPU hotplug notifications in the
suspend/resume path (_FROZEN) in the cpufreq hotplug callback.

Reported-by: Robert Jarzmik <robert.jarzmik@intel.com>
Reported-by: Durgadoss R <durgadoss.r@intel.com>
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
CPUFREQ STATS: Merged some checks from 3.10.y kernel.
CPUFREQ STATS: once again remove commit https://github.com/dorimanx/Dorimanx-LG-G2-D802-Kernel/commit/40cf2f818f45784bab7f81406291b5c28469f8f0 it's not working.

and commit https://github.com/dorimanx/Dorimanx-LG-G2-D802-Kernel/commit/3c9e49908b882631f3737022e707ffddf0b7c230

Interface just show empty table. i dont really need that.
Config. cleanup after driver remove.