Commit graph

926 commits

Author SHA1 Message Date
Ram Chandrasekar
f70b8219bb msm: thermal: Update the hotplug initialization
Hotplug initialization will trigger a hotplug if temperature stays above
the trip threshold and will try to online if temperature is below the
clear threshold. Since KTM does boot mitigation till thermal-engine is
running, hotplug init can be called twice. First from post init script
and second when the hotplug task is initialized. There is a possiblity
the first init call can set the hotplug local mask and the second init
call wont clear or update the mask with correct value if the temperature
is between the hotplug trip and clear threshold.

Update the hotplug init API to perform the check only if the hotplug
task is initialized. Also the hotplug check will clear the hotplug local
mask if the temperature is not above the trip threshold.

Change-Id: Ica1325f8aa65c338ea0e5b201f566607c3ddf904
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
2016-07-21 10:20:07 -06:00
Linux Build Service Account
b10e74ee0a Merge "thermal: tsens: Enable TSENS for msmfalcon" 2016-07-16 07:34:15 -07:00
Runmin Wang
750075feff Merge remote-tracking branch 'origin/tmp-917a9a9133a6' into lsk
* tmp-917a9:
  ARM/vdso: Mark the vDSO code read-only after init
  x86/vdso: Mark the vDSO code read-only after init
  lkdtm: Verify that '__ro_after_init' works correctly
  arch: Introduce post-init read-only memory
  x86/mm: Always enable CONFIG_DEBUG_RODATA and remove the Kconfig option
  mm/init: Add 'rodata=off' boot cmdline parameter to disable read-only kernel mappings
  asm-generic: Consolidate mark_rodata_ro()
  Linux 4.4.6
  ld-version: Fix awk regex compile failure
  target: Drop incorrect ABORT_TASK put for completed commands
  block: don't optimize for non-cloned bio in bio_get_last_bvec()
  MIPS: smp.c: Fix uninitialised temp_foreign_map
  MIPS: Fix build error when SMP is used without GIC
  ovl: fix getcwd() failure after unsuccessful rmdir
  ovl: copy new uid/gid into overlayfs runtime inode
  userfaultfd: don't block on the last VM updates at exit time
  powerpc/powernv: Fix OPAL_CONSOLE_FLUSH prototype and usages
  powerpc/powernv: Add a kmsg_dumper that flushes console output on panic
  powerpc: Fix dedotify for binutils >= 2.26
  Revert "drm/radeon/pm: adjust display configuration after powerstate"
  drm/radeon: Fix error handling in radeon_flip_work_func.
  drm/amdgpu: Fix error handling in amdgpu_flip_work_func.
  Revert "drm/radeon: call hpd_irq_event on resume"
  x86/mm: Fix slow_virt_to_phys() for X86_PAE again
  gpu: ipu-v3: Do not bail out on missing optional port nodes
  mac80211: Fix Public Action frame RX in AP mode
  mac80211: check PN correctly for GCMP-encrypted fragmented MPDUs
  mac80211: minstrel_ht: fix a logic error in RTS/CTS handling
  mac80211: minstrel_ht: set default tx aggregation timeout to 0
  mac80211: fix use of uninitialised values in RX aggregation
  mac80211: minstrel: Change expected throughput unit back to Kbps
  iwlwifi: mvm: inc pending frames counter also when txing non-sta
  can: gs_usb: fixed disconnect bug by removing erroneous use of kfree()
  cfg80211/wext: fix message ordering
  wext: fix message delay/ordering
  ovl: fix working on distributed fs as lower layer
  ovl: ignore lower entries when checking purity of non-directory entries
  ASoC: wm8958: Fix enum ctl accesses in a wrong type
  ASoC: wm8994: Fix enum ctl accesses in a wrong type
  ASoC: samsung: Use IRQ safe spin lock calls
  ASoC: dapm: Fix ctl value accesses in a wrong type
  ncpfs: fix a braino in OOM handling in ncp_fill_cache()
  jffs2: reduce the breakage on recovery from halfway failed rename()
  dmaengine: at_xdmac: fix residue computation
  tracing: Fix check for cpu online when event is disabled
  s390/dasd: fix diag 0x250 inline assembly
  s390/mm: four page table levels vs. fork
  KVM: MMU: fix reserved bit check for ept=0/CR0.WP=0/CR4.SMEP=1/EFER.NX=0
  KVM: MMU: fix ept=0/pte.u=1/pte.w=0/CR0.WP=0/CR4.SMEP=1/EFER.NX=0 combo
  KVM: PPC: Book3S HV: Sanitize special-purpose register values on guest exit
  KVM: s390: correct fprs on SIGP (STOP AND) STORE STATUS
  KVM: VMX: disable PEBS before a guest entry
  kvm: cap halt polling at exactly halt_poll_ns
  PCI: Allow a NULL "parent" pointer in pci_bus_assign_domain_nr()
  ARM: OMAP2+: hwmod: Introduce ti,no-idle dt property
  ARM: dts: dra7: do not gate cpsw clock due to errata i877
  ARM: mvebu: fix overlap of Crypto SRAM with PCIe memory window
  arm64: account for sparsemem section alignment when choosing vmemmap offset
  Linux 4.4.5
  drm/amdgpu: fix topaz/tonga gmc assignment in 4.4 stable
  modules: fix longstanding /proc/kallsyms vs module insertion race.
  drm/i915: refine qemu south bridge detection
  drm/i915: more virtual south bridge detection
  block: get the 1st and last bvec via helpers
  block: check virt boundary in bio_will_gap()
  drm/amdgpu: Use drm_calloc_large for VM page_tables array
  thermal: cpu_cooling: fix out of bounds access in time_in_idle
  i2c: brcmstb: allocate correct amount of memory for regmap
  ubi: Fix out of bounds write in volume update code
  cxl: Fix PSL timebase synchronization detection
  MIPS: traps: Fix SIGFPE information leak from `do_ov' and `do_trap_or_bp'
  MIPS: scache: Fix scache init with invalid line size.
  USB: serial: option: add support for Quectel UC20
  USB: serial: option: add support for Telit LE922 PID 0x1045
  USB: qcserial: add Sierra Wireless EM74xx device ID
  USB: qcserial: add Dell Wireless 5809e Gobi 4G HSPA+ (rev3)
  USB: cp210x: Add ID for Parrot NMEA GPS Flight Recorder
  usb: chipidea: otg: change workqueue ci_otg as freezable
  ALSA: timer: Fix broken compat timer user status ioctl
  ALSA: hdspm: Fix zero-division
  ALSA: hdsp: Fix wrong boolean ctl value accesses
  ALSA: hdspm: Fix wrong boolean ctl value accesses
  ALSA: seq: oss: Don't drain at closing a client
  ALSA: pcm: Fix ioctls for X32 ABI
  ALSA: timer: Fix ioctls for X32 ABI
  ALSA: rawmidi: Fix ioctls X32 ABI
  ALSA: hda - Fix mic issues on Acer Aspire E1-472
  ALSA: ctl: Fix ioctls for X32 ABI
  ALSA: usb-audio: Add a quirk for Plantronics DA45
  adv7604: fix tx 5v detect regression
  dmaengine: pxa_dma: fix cyclic transfers
  Fix directory hardlinks from deleted directories
  jffs2: Fix page lock / f->sem deadlock
  Revert "jffs2: Fix lock acquisition order bug in jffs2_write_begin"
  Btrfs: fix loading of orphan roots leading to BUG_ON
  pata-rb532-cf: get rid of the irq_to_gpio() call
  tracing: Do not have 'comm' filter override event 'comm' field
  ata: ahci: don't mark HotPlugCapable Ports as external/removable
  PM / sleep / x86: Fix crash on graph trace through x86 suspend
  arm64: vmemmap: use virtual projection of linear region
  Adding Intel Lewisburg device IDs for SATA
  writeback: flush inode cgroup wb switches instead of pinning super_block
  block: bio: introduce helpers to get the 1st and last bvec
  libata: Align ata_device's id on a cacheline
  libata: fix HDIO_GET_32BIT ioctl
  drm/amdgpu: return from atombios_dp_get_dpcd only when error
  drm/amdgpu/gfx8: specify which engine to wait before vm flush
  drm/amdgpu: apply gfx_v8 fixes to gfx_v7 as well
  drm/amdgpu/pm: update current crtc info after setting the powerstate
  drm/radeon/pm: update current crtc info after setting the powerstate
  drm/ast: Fix incorrect register check for DRAM width
  target: Fix WRITE_SAME/DISCARD conversion to linux 512b sectors
  iommu/vt-d: Use BUS_NOTIFY_REMOVED_DEVICE in hotplug path
  iommu/amd: Fix boot warning when device 00:00.0 is not iommu covered
  iommu/amd: Apply workaround for ATS write permission check
  arm/arm64: KVM: Fix ioctl error handling
  KVM: x86: fix root cause for missed hardware breakpoints
  vfio: fix ioctl error handling
  Fix cifs_uniqueid_to_ino_t() function for s390x
  CIFS: Fix SMB2+ interim response processing for read requests
  cifs: fix out-of-bounds access in lease parsing
  fbcon: set a default value to blink interval
  kvm: x86: Update tsc multiplier on change.
  mips/kvm: fix ioctl error handling
  parisc: Fix ptrace syscall number and return value modification
  PCI: keystone: Fix MSI code that retrieves struct pcie_port pointer
  block: Initialize max_dev_sectors to 0
  drm/amdgpu: mask out WC from BO on unsupported arches
  btrfs: async-thread: Fix a use-after-free error for trace
  btrfs: Fix no_space in write and rm loop
  Btrfs: fix deadlock running delayed iputs at transaction commit time
  drivers: sh: Restore legacy clock domain on SuperH platforms
  use ->d_seq to get coherency between ->d_inode and ->d_flags
  Linux 4.4.4
  iwlwifi: mvm: don't allow sched scans without matches to be started
  iwlwifi: update and fix 7265 series PCI IDs
  iwlwifi: pcie: properly configure the debug buffer size for 8000
  iwlwifi: dvm: fix WoWLAN
  security: let security modules use PTRACE_MODE_* with bitmasks
  IB/cma: Fix RDMA port validation for iWarp
  x86/irq: Plug vector cleanup race
  x86/irq: Call irq_force_move_complete with irq descriptor
  x86/irq: Remove outgoing CPU from vector cleanup mask
  x86/irq: Remove the cpumask allocation from send_cleanup_vector()
  x86/irq: Clear move_in_progress before sending cleanup IPI
  x86/irq: Remove offline cpus from vector cleanup
  x86/irq: Get rid of code duplication
  x86/irq: Copy vectormask instead of an AND operation
  x86/irq: Check vector allocation early
  x86/irq: Reorganize the search in assign_irq_vector
  x86/irq: Reorganize the return path in assign_irq_vector
  x86/irq: Do not use apic_chip_data.old_domain as temporary buffer
  x86/irq: Validate that irq descriptor is still active
  x86/irq: Fix a race in x86_vector_free_irqs()
  x86/irq: Call chip->irq_set_affinity in proper context
  x86/entry/compat: Add missing CLAC to entry_INT80_32
  x86/mpx: Fix off-by-one comparison with nr_registers
  hpfs: don't truncate the file when delete fails
  do_last(): ELOOP failure exit should be done after leaving RCU mode
  should_follow_link(): validate ->d_seq after having decided to follow
  xen/pcifront: Fix mysterious crashes when NUMA locality information was extracted.
  xen/pciback: Save the number of MSI-X entries to be copied later.
  xen/pciback: Check PF instead of VF for PCI_COMMAND_MEMORY
  xen/scsiback: correct frontend counting
  xen/arm: correctly handle DMA mapping of compound pages
  ARM: at91/dt: fix typo in sama5d2 pinmux descriptions
  ARM: OMAP2+: Fix onenand initialization to avoid filesystem corruption
  do_last(): don't let a bogus return value from ->open() et.al. to confuse us
  kernel/resource.c: fix muxed resource handling in __request_region()
  sunrpc/cache: fix off-by-one in qword_get()
  tracing: Fix showing function event in available_events
  powerpc/eeh: Fix partial hotplug criterion
  KVM: x86: MMU: fix ubsan index-out-of-range warning
  KVM: x86: fix conversion of addresses to linear in 32-bit protected mode
  KVM: x86: fix missed hardware breakpoints
  KVM: arm/arm64: vgic: Ensure bitmaps are long enough
  KVM: async_pf: do not warn on page allocation failures
  of/irq: Fix msi-map calculation for nonzero rid-base
  NFSv4: Fix a dentry leak on alias use
  nfs: fix nfs_size_to_loff_t
  block: fix use-after-free in dio_bio_complete
  bio: return EINTR if copying to user space got interrupted
  i2c: i801: Adding Intel Lewisburg support for iTCO
  phy: core: fix wrong err handle for phy_power_on
  writeback: keep superblock pinned during cgroup writeback association switches
  cgroup: make sure a parent css isn't offlined before its children
  cpuset: make mm migration asynchronous
  PCI/AER: Flush workqueue on device remove to avoid use-after-free
  ARCv2: SMP: Emulate IPI to self using software triggered interrupt
  ARCv2: STAR 9000950267: Handle return from intr to Delay Slot #2
  libata: fix sff host state machine locking while polling
  qla2xxx: Fix stale pointer access.
  spi: atmel: fix gpio chip-select in case of non-DT platform
  target: Fix race with SCF_SEND_DELAYED_TAS handling
  target: Fix remote-port TMR ABORT + se_cmd fabric stop
  target: Fix TAS handling for multi-session se_node_acls
  target: Fix LUN_RESET active TMR descriptor handling
  target: Fix LUN_RESET active I/O handling for ACK_KREF
  ALSA: hda - Fixing background noise on Dell Inspiron 3162
  ALSA: hda - Apply clock gate workaround to Skylake, too
  Revert "workqueue: make sure delayed work run in local cpu"
  workqueue: handle NUMA_NO_NODE for unbound pool_workqueue lookup
  mac80211: Requeue work after scan complete for all VIF types.
  rfkill: fix rfkill_fop_read wait_event usage
  tick/nohz: Set the correct expiry when switching to nohz/lowres mode
  perf stat: Do not clean event's private stats
  cdc-acm:exclude Samsung phone 04e8:685d
  Revert "Staging: panel: usleep_range is preferred over udelay"
  Staging: speakup: Fix getting port information
  sd: Optimal I/O size is in bytes, not sectors
  libceph: don't spam dmesg with stray reply warnings
  libceph: use the right footer size when skipping a message
  libceph: don't bail early from try_read() when skipping a message
  libceph: fix ceph_msg_revoke()
  seccomp: always propagate NO_NEW_PRIVS on tsync
  cpufreq: Fix NULL reference crash while accessing policy->governor_data
  cpufreq: pxa2xx: fix pxa_cpufreq_change_voltage prototype
  hwmon: (ads1015) Handle negative conversion values correctly
  hwmon: (gpio-fan) Remove un-necessary speed_index lookup for thermal hook
  hwmon: (dell-smm) Blacklist Dell Studio XPS 8000
  Thermal: do thermal zone update after a cooling device registered
  Thermal: handle thermal zone device properly during system sleep
  Thermal: initialize thermal zone device correctly
  IB/mlx5: Expose correct maximum number of CQE capacity
  IB/qib: Support creating qps with GFP_NOIO flag
  IB/qib: fix mcast detach when qp not attached
  IB/cm: Fix a recently introduced deadlock
  dmaengine: dw: disable BLOCK IRQs for non-cyclic xfer
  dmaengine: at_xdmac: fix resume for cyclic transfers
  dmaengine: dw: fix cyclic transfer callbacks
  dmaengine: dw: fix cyclic transfer setup
  nfit: fix multi-interface dimm handling, acpi6.1 compatibility
  ACPI / PCI / hotplug: unlock in error path in acpiphp_enable_slot()
  ACPI: Revert "ACPI / video: Add Dell Inspiron 5737 to the blacklist"
  ACPI / video: Add disable_backlight_sysfs_if quirk for the Toshiba Satellite R830
  ACPI / video: Add disable_backlight_sysfs_if quirk for the Toshiba Portege R700
  lib: sw842: select crc32
  uapi: update install list after nvme.h rename
  ideapad-laptop: Add Lenovo Yoga 700 to no_hw_rfkill dmi list
  ideapad-laptop: Add Lenovo ideapad Y700-17ISK to no_hw_rfkill dmi list
  toshiba_acpi: Fix blank screen at boot if transflective backlight is supported
  make sure that freeing shmem fast symlinks is RCU-delayed
  drm/radeon/pm: adjust display configuration after powerstate
  drm/radeon: Don't hang in radeon_flip_work_func on disabled crtc. (v2)
  drm: Fix treatment of drm_vblank_offdelay in drm_vblank_on() (v2)
  drm: Fix drm_vblank_pre/post_modeset regression from Linux 4.4
  drm: Prevent vblank counter bumps > 1 with active vblank clients. (v2)
  drm: No-Op redundant calls to drm_vblank_off() (v2)
  drm/radeon: use post-decrement in error handling
  drm/qxl: use kmalloc_array to alloc reloc_info in qxl_process_single_command
  drm/i915: fix error path in intel_setup_gmbus()
  drm/i915/dsi: don't pass arbitrary data to sideband
  drm/i915/dsi: defend gpio table against out of bounds access
  drm/i915/skl: Don't skip mst encoders in skl_ddi_pll_select()
  drm/i915: Don't reject primary plane windowing with color keying enabled on SKL+
  drm/i915/dp: fall back to 18 bpp when sink capability is unknown
  drm/i915: Make sure DC writes are coherent on flush.
  drm/i915: Init power domains early in driver load
  drm/i915: intel_hpd_init(): Fix suspend/resume reprobing
  drm/i915: Restore inhibiting the load of the default context
  drm: fix missing reference counting decrease
  drm/radeon: hold reference to fences in radeon_sa_bo_new
  drm/radeon: mask out WC from BO on unsupported arches
  drm: add helper to check for wc memory support
  drm/radeon: fix DP audio support for APU with DCE4.1 display engine
  drm/radeon: Add a common function for DFS handling
  drm/radeon: cleaned up VCO output settings for DP audio
  drm/radeon: properly byte swap vce firmware setup
  drm/radeon: clean up fujitsu quirks
  drm/radeon: Fix "slow" audio over DP on DCE8+
  drm/radeon: call hpd_irq_event on resume
  drm/radeon: Fix off-by-one errors in radeon_vm_bo_set_addr
  drm/dp/mst: deallocate payload on port destruction
  drm/dp/mst: Reverse order of MST enable and clearing VC payload table.
  drm/dp/mst: move GUID storage from mgr, port to only mst branch
  drm/dp/mst: Calculate MST PBN with 31.32 fixed point
  drm: Add drm_fixp_from_fraction and drm_fixp2int_ceil
  drm/dp/mst: fix in RAD element access
  drm/dp/mst: fix in MSTB RAD initialization
  drm/dp/mst: always send reply for UP request
  drm/dp/mst: process broadcast messages correctly
  drm/nouveau: platform: Fix deferred probe
  drm/nouveau/disp/dp: ensure sink is powered up before attempting link training
  drm/nouveau/display: Enable vblank irqs after display engine is on again.
  drm/nouveau/kms: take mode_config mutex in connector hotplug path
  drm/amdgpu/pm: adjust display configuration after powerstate
  drm/amdgpu: Don't hang in amdgpu_flip_work_func on disabled crtc.
  drm/amdgpu: use post-decrement in error handling
  drm/amdgpu: fix issue with overlapping userptrs
  drm/amdgpu: hold reference to fences in amdgpu_sa_bo_new (v2)
  drm/amdgpu: remove unnecessary forward declaration
  drm/amdgpu: fix s4 resume
  drm/amdgpu: remove exp hardware support from iceland
  drm/amdgpu: don't load MEC2 on topaz
  drm/amdgpu: drop topaz support from gmc8 module
  drm/amdgpu: pull topaz gmc bits into gmc_v7
  drm/amdgpu: The VI specific EXE bit should only apply to GMC v8.0 above
  drm/amdgpu: iceland use CI based MC IP
  drm/amdgpu: move gmc7 support out of CIK dependency
  drm/amdgpu: no need to load MC firmware on fiji
  drm/amdgpu: fix amdgpu_bo_pin_restricted VRAM placing v2
  drm/amdgpu: fix tonga smu resume
  drm/amdgpu: fix lost sync_to if scheduler is enabled.
  drm/amdgpu: call hpd_irq_event on resume
  drm/amdgpu: Fix off-by-one errors in amdgpu_vm_bo_map
  drm/vmwgfx: respect 'nomodeset'
  drm/vmwgfx: Fix a width / pitch mismatch on framebuffer updates
  drm/vmwgfx: Fix an incorrect lock check
  virtio_pci: fix use after free on release
  virtio_balloon: fix race between migration and ballooning
  virtio_balloon: fix race by fill and leak
  regulator: mt6311: MT6311_REGULATOR needs to select REGMAP_I2C
  regulator: axp20x: Fix GPIO LDO enable value for AXP22x
  clk: exynos: use irqsave version of spin_lock to avoid deadlock with irqs
  cxl: use correct operator when writing pcie config space values
  sparc64: fix incorrect sign extension in sys_sparc64_personality
  EDAC, mc_sysfs: Fix freeing bus' name
  EDAC: Robustify workqueues destruction
  MIPS: Fix buffer overflow in syscall_get_arguments()
  MIPS: Fix some missing CONFIG_CPU_MIPSR6 #ifdefs
  MIPS: hpet: Choose a safe value for the ETIME check
  MIPS: Loongson-3: Fix SMP_ASK_C0COUNT IPI handler
  Revert "MIPS: Fix PAGE_MASK definition"
  cputime: Prevent 32bit overflow in time[val|spec]_to_cputime()
  time: Avoid signed overflow in timekeeping_get_ns()
  Bluetooth: 6lowpan: Fix handling of uncompressed IPv6 packets
  Bluetooth: 6lowpan: Fix kernel NULL pointer dereferences
  Bluetooth: Fix incorrect removing of IRKs
  Bluetooth: Add support of Toshiba Broadcom based devices
  Bluetooth: Use continuous scanning when creating LE connections
  Drivers: hv: vmbus: Fix a Host signaling bug
  tools: hv: vss: fix the write()'s argument: error -> vss_msg
  mmc: sdhci: Allow override of get_cd() called from sdhci_request()
  mmc: sdhci: Allow override of mmc host operations
  mmc: sdhci-pci: Fix card detect race for Intel BXT/APL
  mmc: pxamci: fix again read-only gpio detection polarity
  mmc: sdhci-acpi: Fix card detect race for Intel BXT/APL
  mmc: mmci: fix an ages old detection error
  mmc: core: Enable tuning according to the actual timing
  mmc: sdhci: Fix sdhci_runtime_pm_bus_on/off()
  mmc: mmc: Fix incorrect use of driver strength switching HS200 and HS400
  mmc: sdio: Fix invalid vdd in voltage switch power cycle
  mmc: sdhci: Fix DMA descriptor with zero data length
  mmc: sdhci-pci: Do not default to 33 Ohm driver strength for Intel SPT
  mmc: usdhi6rol0: handle NULL data in timeout
  clockevents/tcb_clksrc: Prevent disabling an already disabled clock
  posix-clock: Fix return code on the poll method's error path
  irqchip/gic-v3-its: Fix double ICC_EOIR write for LPI in EOImode==1
  irqchip/atmel-aic: Fix wrong bit operation for IRQ priority
  irqchip/mxs: Add missing set_handle_irq()
  irqchip/omap-intc: Add support for spurious irq handling
  coresight: checking for NULL string in coresight_name_match()
  dm: fix dm_rq_target_io leak on faults with .request_fn DM w/ blk-mq paths
  dm snapshot: fix hung bios when copy error occurs
  dm space map metadata: remove unused variable in brb_pop()
  tda1004x: only update the frontend properties if locked
  vb2: fix a regression in poll() behavior for output,streams
  gspca: ov534/topro: prevent a division by 0
  si2157: return -EINVAL if firmware blob is too big
  media: dvb-core: Don't force CAN_INVERSION_AUTO in oneshot mode
  rc: sunxi-cir: Initialize the spinlock properly
  namei: ->d_inode of a pinned dentry is stable only for positives
  mei: validate request value in client notify request ioctl
  mei: fix fasync return value on error
  rtlwifi: rtl8723be: Fix module parameter initialization
  rtlwifi: rtl8188ee: Fix module parameter initialization
  rtlwifi: rtl8192se: Fix module parameter initialization
  rtlwifi: rtl8723ae: Fix initialization of module parameters
  rtlwifi: rtl8192de: Fix incorrect module parameter descriptions
  rtlwifi: rtl8192ce: Fix handling of module parameters
  rtlwifi: rtl8192cu: Add missing parameter setup
  rtlwifi: rtl_pci: Fix kernel panic
  locks: fix unlock when fcntl_setlk races with a close
  um: link with -lpthread
  uml: fix hostfs mknod()
  uml: flush stdout before forking
  s390/fpu: signals vs. floating point control register
  s390/compat: correct restore of high gprs on signal return
  s390/dasd: fix performance drop
  s390/dasd: fix refcount for PAV reassignment
  s390/dasd: prevent incorrect length error under z/VM after PAV changes
  s390: fix normalization bug in exception table sorting
  btrfs: initialize the seq counter in struct btrfs_device
  Btrfs: Initialize btrfs_root->highest_objectid when loading tree root and subvolume roots
  Btrfs: fix transaction handle leak on failure to create hard link
  Btrfs: fix number of transaction units required to create symlink
  Btrfs: send, don't BUG_ON() when an empty symlink is found
  btrfs: statfs: report zero available if metadata are exhausted
  Btrfs: igrab inode in writepage
  Btrfs: add missing brelse when superblock checksum fails
  KVM: s390: fix memory overwrites when vx is disabled
  s390/kvm: remove dependency on struct save_area definition
  clocksource/drivers/vt8500: Increase the minimum delta
  genirq: Validate action before dereferencing it in handle_irq_event_percpu()
  mm: numa: quickly fail allocations for NUMA balancing on full nodes
  mm: thp: fix SMP race condition between THP page fault and MADV_DONTNEED
  ocfs2: unlock inode if deleting inode from orphan fails
  drm/i915: shut up gen8+ SDE irq dmesg noise
  iw_cxgb3: Fix incorrectly returning error on success
  spi: omap2-mcspi: Prevent duplicate gpio_request
  drivers: android: correct the size of struct binder_uintptr_t for BC_DEAD_BINDER_DONE
  USB: option: add "4G LTE usb-modem U901"
  USB: option: add support for SIM7100E
  USB: cp210x: add IDs for GE B650V3 and B850V3 boards
  usb: dwc3: Fix assignment of EP transfer resources
  can: ems_usb: Fix possible tx overflow
  dm thin: fix race condition when destroying thin pool workqueue
  bcache: Change refill_dirty() to always scan entire disk if necessary
  bcache: prevent crash on changing writeback_running
  bcache: allows use of register in udev to avoid "device_busy" error.
  bcache: unregister reboot notifier if bcache fails to unregister device
  bcache: fix a leak in bch_cached_dev_run()
  bcache: clear BCACHE_DEV_UNLINK_DONE flag when attaching a backing device
  bcache: Add a cond_resched() call to gc
  bcache: fix a livelock when we cause a huge number of cache misses
  lib/ucs2_string: Correct ucs2 -> utf8 conversion
  efi: Add pstore variables to the deletion whitelist
  efi: Make efivarfs entries immutable by default
  efi: Make our variable validation list include the guid
  efi: Do variable name validation tests in utf8
  efi: Use ucs2_as_utf8 in efivarfs instead of open coding a bad version
  lib/ucs2_string: Add ucs2 -> utf8 helper functions
  ARM: 8457/1: psci-smp is built only for SMP
  drm/gma500: Use correct unref in the gem bo create function
  devm_memremap: Fix error value when memremap failed
  KVM: s390: fix guest fprs memory leak
  arm64: errata: Add -mpc-relative-literal-loads to build flags
  ARM: debug-ll: fix BCM63xx entry for multiplatform
  ext4: fix bh->b_state corruption
  sctp: Fix port hash table size computation
  unix_diag: fix incorrect sign extension in unix_lookup_by_ino
  tipc: unlock in error path
  rtnl: RTM_GETNETCONF: fix wrong return value
  IFF_NO_QUEUE: Fix for drivers not calling ether_setup()
  tcp/dccp: fix another race at listener dismantle
  route: check and remove route cache when we get route
  net_sched fix: reclassification needs to consider ether protocol changes
  pppoe: fix reference counting in PPPoE proxy
  l2tp: Fix error creating L2TP tunnels
  net/mlx4_en: Avoid changing dev->features directly in run-time
  net/mlx4_en: Choose time-stamping shift value according to HW frequency
  net/mlx4_en: Count HW buffer overrun only once
  qmi_wwan: add "4G LTE usb-modem U901"
  tcp: md5: release request socket instead of listener
  tipc: fix premature addition of node to lookup table
  af_unix: Guard against other == sk in unix_dgram_sendmsg
  af_unix: Don't set err in unix_stream_read_generic unless there was an error
  ipv4: fix memory leaks in ip_cmsg_send() callers
  bonding: Fix ARP monitor validation
  bpf: fix branch offset adjustment on backjumps after patching ctx expansion
  flow_dissector: Fix unaligned access in __skb_flow_dissector when used by eth_get_headlen
  net: Copy inner L3 and L4 headers as unaligned on GRE TEB
  sctp: translate network order to host order when users get a hmacid
  enic: increment devcmd2 result ring in case of timeout
  tg3: Fix for tg3 transmit queue 0 timed out when too many gso_segs
  net:Add sysctl_max_skb_frags
  tcp: do not drop syn_recv on all icmp reports
  unix: correctly track in-flight fds in sending process user_struct
  ipv6: fix a lockdep splat
  ipv6: addrconf: Fix recursive spin lock call
  ipv6/udp: use sticky pktinfo egress ifindex on connect()
  ipv6: enforce flowi6_oif usage in ip6_dst_lookup_tail()
  tcp: beware of alignments in tcp_get_info()
  switchdev: Require RTNL mutex to be held when sending FDB notifications
  inet: frag: Always orphan skbs inside ip_defrag()
  tipc: fix connection abort during subscription cancel
  net: dsa: fix mv88e6xxx switches
  sctp: allow setting SCTP_SACK_IMMEDIATELY by the application
  pptp: fix illegal memory access caused by multiple bind()s
  af_unix: fix struct pid memory leak
  tcp: fix NULL deref in tcp_v4_send_ack()
  lwt: fix rx checksum setting for lwt devices tunneling over ipv6
  tunnels: Allow IPv6 UDP checksums to be correctly controlled.
  net: dp83640: Fix tx timestamp overflow handling.
  gro: Make GRO aware of lightweight tunnels.
  af_iucv: Validate socket address length in iucv_sock_bind()

Conflicts:
	arch/arm64/Makefile
	arch/arm64/include/asm/cacheflush.h
	drivers/mmc/host/sdhci.c
	drivers/usb/dwc3/ep0.c
	drivers/usb/dwc3/gadget.c
	kernel/module.c
	sound/core/pcm_compat.c

CRs-Fixed: 1010239
Signed-off-by: Runmin Wang <runminw@codeaurora.org>
Change-Id: I41a28636fc9ad91f9d979b191784609476294cdf
2016-07-12 11:40:49 -07:00
Ram Chandrasekar
c02e00ef9d driver: thermal: Configure ARM threshold instead of low
LMH DCVSh will retain the mitigation till it clears the Low
threshold. With mitigation happening at 95C, configuring the
low threshold as 65C will hold the mitigation till it clears 65C,
which will impact the performance.

Instead of configuring the low threshold, configure the ARM threshold
from HLOS and low threshold will be configured 2C less than the
high threshold in the trust zone.

CRs-Fixed: 1024370
Change-Id: Ifb303d7266c98eb94c5eb6f806b7c5e1d95236d3
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
2016-07-11 18:56:33 -07:00
Rama Krishna Phani A
3afd0a224e thermal: tsens: Enable TSENS for msmfalcon
Temperature sensor (TSENS) driver provides ability to
thermal clients to read from on-die temperature sensors.
msmfalcon supports reading from 14 on-die temperature
sensors and clients can set temperature thresholds and
receive notification.

Change-Id: I9421af7d1b2b83abb81af38fab5f7c6e9285a29d
Signed-off-by: Rama Krishna Phani A <rphani@codeaurora.org>
2016-07-11 20:30:47 +05:30
Siddartha Mohanadoss
6e8583cdf3 thermal: tsens: Enable TSENS controller health monitor
Temperature sensor (TSENS) driver health monitor periodically
sets a very low temperature threshold on the critical trip zone
and polls to check if the trip is set. This is done on a deferred
workqueue and helps provide indication on the health of the
TSENS controller.

Change-Id: I4b16db429fead5c731dec289f0360682c92775b8
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2016-07-05 15:34:41 -07:00
Siddartha Mohanadoss
52e8201e7b thermal: tsens: Enable TSENS for msmhamster
Temperature sensor (TSENS) driver provides ability to
thermal clients to read from on-die temperature sensors.
msmhamster supports reading from 20 on-die temperature
sensors and clients can set temperature thresholds and
receive notification.

Change-Id: I57e98f2182d0c44e9c7cffec3528bb926a878fb8
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2016-07-05 15:34:24 -07:00
Manaf Meethalavalappu Pallikunhi
be375a03c7 msm: thermal: Add support to monitor only one tsens for MX restriction
Currently VDD MX restriction feature monitors all tsens for low
temperature condition. Some targets which has higher MX restriction
thresholds shows frequent interrupts from multiple sensors causing
power impact.
Add support to monitor only one sensor for VDD MX restriction feature.
Add an optional device tree property "qcom,mx-restriction-sensor_id"
to specify sensor id for monitor. If not defined, monitor all tsens
for VDD MX restriction.

Change-Id: Ib709b00c27f43c2603ac8a08b75f2fbd5800983b
Signed-off-by: Manaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
2016-07-05 15:33:53 -07:00
Manaf Meethalavalappu Pallikunhi
d2cb754944 msm: thermal: Maintain state in the mitigation device monitor
If KTM get a trip threshold trigger notification and if the
temperature stays the same as the recent trip threshold, KTM will
re-activate the recently triggered threshold, resulting in back to
back interrupts. To avoid this add support in KTM to maintain the
recently triggered threshold state and then re-active the threshold
based on the last threshold trip.
This state is updated for mitigation features like VDD MX retention,
CX phase control, VDD restriction, OCR monitor and external clients
like CPR low temperature monitor etc.

CRs-Fixed: 969112 972634
Change-Id: I44c0a93e1507a9f0b8a65e5c2ce5a98962bb335b
Signed-off-by: Manaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
2016-06-29 15:00:39 -07:00
Ram Chandrasekar
432cb528fd drivers: thermal: Add ftrace events for LMH DCVSh mitigation
LMH DCVSh driver receives interrupt from hardware whenever there is a
new mitigation frequency decision is made in hardware.

Add ftrace event to print the hardware mitigation frequency value from
driver.

Change-Id: Ib357ee3c3a461613bfd1268ec8f98973c2982c10
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
2016-06-07 16:06:08 -07:00
Ram Chandrasekar
1884f6ccf9 drivers: thermal: Read the mitigation frequency and notify scheduler
LMH DCVSh hardware can send interrupts whenever the hardware mitigation
blocks make a new frequency mitigation vote. scheduler is not aware of
any of the hardware mitigation.

Add support to listen for this interrupt, read the aggregated mitigation
frequency from all LMH DCVSh block and notify scheduler. After receiving
interrupt, poll the hardware periodically for the mitigation frequency
till the mitigation is cleared by hardware. Once the mitigation is
cleared, interrupt is re-enabled.

Change-Id: I38bc0c80710038f135289420d6b20c1ff0ab06eb
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
2016-06-07 11:56:09 -07:00
Manaf Meethalavalappu Pallikunhi
ae40e64b2d msm: thermal: Check clients request just after frequency thread init
KTM frequency mitigation thread initializes during late init call.
Prior to this, client can request frequency mitigation. But request
will not be processed, since frequency mitigation thread won't be
initialized. Notify frequency mitigation thread to aggregate clients
current request immediately after thread initialization.

Change-Id: Id2425041b14554d58f944794e1b5db273f5ded26
Signed-off-by: Manaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
2016-06-03 14:49:03 -07:00
Siddartha Mohanadoss
8b2d1771d2 thermal: tsens: Update critical temperature threshold value
Existing controller health detection uses a critical
temperature threshold of -40degC. Update the value to -95degC
so that there are no false positives seen when min threshold
is disabled and temperature goes below the threshold value.

Change-Id: If27ecfbb7b080080074bfe142f493fbf8f53f673
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2016-06-01 15:27:21 -07:00
David Collins
518ffca094 thermal: qpnp-temp-alarm: add support for GEN2 PMIC peripherals
Add support for the TEMP_ALARM GEN2 PMIC peripheral subtype.  The
GEN2 subtype adds clock rate control and defines an over
temperature state with hysteresis instead of stage in the status
register.  There are two GEN2 states corresponding to stages 1
and 2.

Change-Id: Ic4ad048259eb3a356333e0529d52f39c39fc915f
CRs-Fixed: 1019272
Signed-off-by: David Collins <collinsd@codeaurora.org>
2016-05-27 14:53:53 -07:00
David Collins
b31b0103f0 thermal: qpnp-temp-alarm: update thermal callback parameters
Change the type of temperatures in the qpnp-temp-alarm driver
from unsigned long to int.  This ensures that the driver can be
compiled successfully when the following commit is in place
which changed temperatures in the  thermal framework from
unsigned long to int: commit 17e8351a77 ("thermal: consistently
use int for temperatures").

Change-Id: I38c637936b398f2fb1665c8233ed5e49e83bf296
CRs-Fixed: 1019272
Signed-off-by: David Collins <collinsd@codeaurora.org>
2016-05-25 14:20:01 -07:00
Ram Chandrasekar
595ef42db8 msm: thermal: Update the min frequency update logic
With LMH DCVSh hardware, the current check will use cpufreq to
limit both scaling min and max frequency. But cpufreq should be
used only for scaling min frequency.

Update the check to use cpufreq only to limit scaling min frequency.

Change-Id: I38de1699a7cdd5bc3fecef80dd34c4d22d2fd200
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
2016-05-12 15:06:59 -07:00
Ram Chandrasekar
c8a89f3b19 msm: thermal: Avoid updating the scaling max frequency to cpufreq
With LMH DCVSh hardware, thermal driver can directly vote in the
hardware to limit the scaling max frequency. Voting to the cpufreq
driver along side the hardware, will introduce software delay when
removing the mitigation.

So avoid voting the scaling max frequency to the cpufreq when LMH DCVSh
is available.

Change-Id: I8a5f913ae41263b06af99b0ee802b4fa68312f33
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
2016-05-12 15:06:47 -07:00
Siddartha Mohanadoss
81a5895080 thermal: qpnp-adc-tm: Support refreshed BTM driver
The BTM (Battery temperature module) peripheral driver
on the PMIC (Power management IC) supports threshold
monitoring and notifies clients when thresholds are crossed.
PMCOBALT supports refreshed BTM peripheral register interface
and the driver uses compatible property qpnp-adc-tm-hc to
distinguish using the refreshed peripheral. The external
client interface with the driver remains the same. Updates
include handling the interrupt when the thresholds are
crossed,programming the threholds and configuring
the hardware based on the refreshed design.

BTM peripheral needs the VADC_HC peripheral to compute the
gain/offset that are used to reverse compute the threhold
values to ADC code. Some of the reverse computation API's
such as calculating thermistor thresholds require the
gain and offset values before computing the ADC code to
be programmed. This requires modification to the existing
calibration API in the VADC_HC driver to calculate
the reference calibration points and store these values
for clients to use in the reverse computation

Change-Id: I989cfa4f40e7f1671f04dfa9d4c3fe2ccbbc44ab
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2016-05-10 13:20:13 -07:00
Ram Chandrasekar
3f6bd88967 msm: lmh_lite: Use dynamic memory for getting sensor list
LMH lite driver allocates DMA memory for getting the
sensor list from trustzone. DMA memory is not needed for
this operation, so use dynamic memory.

CRs-Fixed: 1010120
Change-Id: Ia7ef920a0f34334e49d76efc5ba233aa58aeb273
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
2016-05-09 18:35:29 -07:00
Ram Chandrasekar
6c28948e60 msm: lmh_interface: Support new thermal core framework APIs
Thermal core framework allows reading negative temperature and to
support that, thermal core APIs will read temperature in integer.

Inline with thermal core changes, modify the parameters to read
temperature to integer from signed long.

CRs-Fixed: 1010120
Change-Id: I975c11aa4e63e01ee3274a577b51b37c1c0f78cd
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
2016-05-09 18:35:29 -07:00
Ram Chandrasekar
31d6a43a24 msm: lmh_interface: support new sequence print functions
New sequence print functions doesn't return error on overflow.
Use the new API to check for overflow and then return error
from LMH interface driver.

CRS-FIxed: 1010120
Change-Id: I12c496f3c72398845a9039607b27112196afe38a
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
2016-05-06 12:06:27 -07:00
Ram Chandrasekar
641798a0d2 msm: thermal: Remove support for asynchronous cluster
KTM has support for handling cluster with asynchronous cores within
a cluster. KTM can get the individual clock plans for the cores and
mitigate them separately. This feature is not supported in
hardware.

So remove the asynchronous cluster support from KTM.

CRs-Fixed: 1010111
Change-Id: I13348a16e2e1c11053cf5b99b921fd8ea65c7d89
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
2016-05-06 12:06:27 -07:00
Ram Chandrasekar
77bcd51608 msm: thermal: Make boot-up mitigation optional
For the targets with the LMH DCVSh mitigation, HLOS boot-up
mitigation is not required. So make the devicetree properties
related to boot-up mitigation as optional.

CRs-Fixed: 1010111
Change-Id: I7f254f579182effbc1f1a3d49c3c917d3c7af162
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
2016-05-05 15:05:55 -07:00
Ram Chandrasekar
07f3dcfc7f msm: thermal: Prolong KTM mitigation till thermal-engine takesover
KTM stops the boot time mitigation during late init
and thermal engine takes over the mitigation only after
a delay.

Modify KTM to prolong the boot time mitigation till
thermal-engine sends a disable command. This ensures a
safe handover.

CRs-Fixed: 1007266
Change-Id: Icb876f16cac9471c523f3ef5b5fd3ede9d5d597c
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
2016-05-05 15:05:51 -07:00
Ram Chandrasekar
6e2d82b201 msm: thermal: Reorganize KTM probe function
Reorganize KTM probe function by grouping and separating them
based on functionalities. The deferrable properties and sysfs
node creation are grouped into two separate function
calls.

CRs-Fixed: 1010111
Change-Id: If144319371a5c65f193ffac8fb9852a836125966
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
2016-05-05 15:05:51 -07:00
Ram Chandrasekar
a004a8c07b msm: thermal: Remove proactive vdd restriction during probe
Vdd restriction probe will apply mitigation, which will be cleared
later during the KTM boot mitigation. KTM now initializes the
data structures to do this mitigation only after vdd restriction probe.

So remove this pro-active mitigation in the probe function. KTM boot
mitigation will be started immediately after the KTM probe and can take
care of this mitigation.

CRs-Fixed: 1010111
Change-Id: Ica59aeb0c94581e3c37b5b7df16c187ced45c28a
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
2016-05-05 15:05:51 -07:00
Caesar Wang
1f5c4e0cb8 thermal: rockchip: fix a impossible condition caused by the warning
commit 43b4eb9fe719b107c8e5d49d1edbff0c135a42cb upstream.

As the Dan report the smatch check the thermal driver warning:
drivers/thermal/rockchip_thermal.c:551 rockchip_configure_from_dt()
warn: impossible condition '(thermal->tshut_temp > ((~0 >> 1))) =>
(s32min-s32max > s32max)'

Although The shut_temp read from DT is u32,the temperature is currently
represented as int not long in the thermal driver.
Let's change to make shut_temp instead of the thermal->tshut_temp for
the condition.

Fixes: commit 437df2172e
("thermal: rockchip: consistently use int for temperatures")

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-05-04 14:48:54 -07:00
Lina Iyer
5132bf6146 drivers: msm_thermal: use OSM to set CPU freq limits
On SoCs that have OSM hardware, use the hardware to setup the CPU
mitigation limits. Having the OSM control CPU frequencies offloads
mitigation from the CPU, resulting in faster thermal mitigation
response.

The LMH DCVS aggregation does not do a max of the min frequency limits.
Therefore to avoid cpufreq voting any lesser than what KTM decides based
on vdd min restrictions, we update cpufreq as well, only if the min freq
has changed.

Change-Id: I2912eaf418d5e7ea4d62a9a55702e02b744a785b
Signed-off-by: Lina Iyer <ilina@codeaurora.org>
2016-04-26 14:38:00 -07:00
Lina Iyer
abc784c00c drivers: thermal: add LMH-DCVS driver
The Limits Management Hardware (LMH-DCVS) is a hardware block for
monitoring thermal profiles and taking immediate action to control
temperature without software intervention. The h/w block can only be
configured under secure mode.

The LMH-DCVS block reads CPU temperatures of a cluster by sensing
information from the TSENS hardware and determines the course of action.
When enabled, the h/w triggers when the high threshold is hit for any
CPU in the cluster. The mitigative action is frequency and voltage
control that is provided to the OSM hardware.

The driver registers a virtual thermal zone device for each hardware
instance. The thermal zone device is used to set the thresholds for the
hardware to work on. Once the thresholds are setup and the trip type is
enabled, the hardware functions autonomously. Mitigative action is
completely controlled in the h/w.

Writing to the actual hardware is done through the SCM call.

Change-Id: I70d4bc387717491256fec1ef6bd8cd6a28ea641b
Signed-off-by: Lina Iyer <ilina@codeaurora.org>
2016-04-26 14:37:59 -07:00
Ram Chandrasekar
168629b495 msm: thermal: Support thermal driver for 4.4 kernel
Fix compilation issues. Replace deprecated APIs with
the new APIs for 4.4 kernel.

Change-Id: I0cd5adc5c9c6ff9979b6d3a626541e6755029d2f
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
2016-04-25 17:46:25 -07:00
Manaf Meethalavalappu Pallikunhi
8e9dbc4e1d msm: thermal: Request INT_MAX as max for regulator set voltage API
During Vdd restriction trigger/clear request, KTM request it's vote
to regulator via regulator_set_voltage() API. KTM is interested only
in min value for this feature, always request INT_MAX as max value
instead of supported MAX corner of that regulator. It makes sure
that there is no impact if MAX corner for that regulator is changed
at any time.

Change-Id: Iebcb0383ea7b44d8584adb610ca7b56f0db2e755
Signed-off-by: Manaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
2016-04-22 14:56:41 -07:00
Zhang Rui
d75936f3f9 Thermal: Ignore invalid trip points
commit 81ad4276b505e987dd8ebbdf63605f92cd172b52 upstream.

In some cases, platform thermal driver may report invalid trip points,
thermal core should not take any action for these trip points.

This fixed a regression that bogus trip point starts to screw up thermal
control on some Lenovo laptops, after
commit bb431ba26c5cd0a17c941ca6c3a195a3a6d5d461
Author: Zhang Rui <rui.zhang@intel.com>
Date:   Fri Oct 30 16:31:47 2015 +0800

    Thermal: initialize thermal zone device correctly

    After thermal zone device registered, as we have not read any
    temperature before, thus tz->temperature should not be 0,
    which actually means 0C, and thermal trend is not available.
    In this case, we need specially handling for the first
    thermal_zone_device_update().

    Both thermal core framework and step_wise governor is
    enhanced to handle this. And since the step_wise governor
    is the only one that uses trends, so it's the only thermal
    governor that needs to be updated.

    Tested-by: Manuel Krause <manuelkrause@netscape.net>
    Tested-by: szegad <szegadlo@poczta.onet.pl>
    Tested-by: prash <prash.n.rao@gmail.com>
    Tested-by: amish <ammdispose-arch@yahoo.com>
    Tested-by: Matthias <morpheusxyz123@yahoo.de>
    Reviewed-by: Javi Merino <javi.merino@arm.com>
    Signed-off-by: Zhang Rui <rui.zhang@intel.com>
    Signed-off-by: Chen Yu <yu.c.chen@intel.com>

Link: https://bugzilla.redhat.com/show_bug.cgi?id=1317190
Link: https://bugzilla.kernel.org/show_bug.cgi?id=114551
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-12 09:08:35 -07:00
Manaf Meethalavalappu Pallikunhi
c35b73cf03 msm: lmh_lite: Pass proper size for dma memory free API call
Use proper size for dma memory free call API while saving lmh sensors
list in lmh hardware driver otherwise it leads to memory leak or
unexpected crash if scm_call error path is executed.

CRs-Fixed: 982320
Change-Id: I31ac79585c8899b44ece745676d9af79fe8bca78
Signed-off-by: Manaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
2016-03-25 16:02:32 -07:00
Satya Durga Srinivasu Prabhala
66bca60974 thermal-core: fix compilation warnings on Kernel 4.4
This change fixes below compilation warnings on Kernel 4.4.

thermal_core.c:303:2: warning: format '%d' expects argument of \
type 'int', but argument 4 has type 'long int' [-Wformat=]

thermal_core.c:303:2: warning: format '%d' expects argument of \
type 'int', but argument 5 has type 'long int' [-Wformat=]

Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
2016-03-23 21:25:02 -07:00
David Keitel
3967f5a43f thermal: tsens: use cvt timer.
Linux Kernel 4.4 enforces the use of cvt timers in kernel and userspace.

Fix this in the tsens driver.

Signed-off-by: David Keitel <dkeitel@codeaurora.org>
2016-03-23 21:21:46 -07:00
Mahesh Sivasubramanian
f0fc4d5eda msm: thermal: Add range checking for cluster_id
The cluster id flag is passed in from the userspace through ioctl
interface. Ensure correctness of cluster id to avoid out of bounds array
accesses.

CRS-fixed: 977508
Change-Id: I778b962d347b90488b983a15087b13e90ad06688
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
2016-03-23 21:20:48 -07:00
Rama Krishna Phani A
338086ed12 thermal: tsens: Update condition in critical_irq
Device crash is observed when the critical_irq is triggered because of
accessing uninitialized completion variable.

Update condition in critical_irq such that the completion variable will be
accessed only when initialized.

Change-Id: I0cba089882024bbe36ac4798866af4e33ee02fa2
Signed-off-by: Rama Krishna Phani A <rphani@codeaurora.org>
2016-03-23 21:18:50 -07:00
Siddartha Mohanadoss
193773678c thermal: tsens: Add Cobalt TSENS support
MSM Cobalt TSENS supports upto 22 temperature
sensors across two TSENS controllers. Thermal
clients have the ability to set temperature
threshold and receive notification on a threshold
crossing.

Change-Id: I05d6f7cfceece6c27ef5d03b9ea3b77d409108db
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2016-03-23 21:16:43 -07:00
Siddartha Mohanadoss
75003eedd6 thermal: tsens: Modify tsens_poll
Add support to log the last 10 instances when the
tsens monitoring threshold test gets to run and
handles completion interrupt or in polling mode.
In addition clear the status before enabling the
interrupt mask for threshold monitoring and reduce
the timed wait completion during polling mode.

Change-Id: I75a376b209f15d33cdfe3e43806db0f0cf45538e
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2016-03-23 21:16:05 -07:00
Ram Chandrasekar
4f9f3cdabf msm: limits: Add support to handle data greater than PAGE_SIZE
Debug data read was not handling the buffer overflow case when
the data to write is greater than PAGE_SIZE. This resulted in
calling the hardware for new data multiple times.

Returning success when buffer overflowed will cause the sequence
traverse function to call again with a new buffer with increased
size. This process will go on until the buffer size is big enough
to hold the data. But limits data read function couldn't distinguish
if the call is a retry or a new call and will initiate a new data
fetch from hardware and re-populate with new data.

Modify debug read interface to immediately return success when
overflow happens. The debug read function now can distinguish between
a sequence retry call by retaining the data buffer in a static if
overflow happens. When called again, debug read now will avoid
calling the hardware for new data and instead will populate the new
sequence buffer with the previously fetched data.

Change-Id: Icc0eb035047ab734d2eb5366cade4ec187747379
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
2016-03-23 21:15:28 -07:00
Ram Chandrasekar
ff6a8d7123 msm: lmh_lite: Remove primary interrupt handler
The primary interrupt handler disables the lmh interrupt. But
this is already taken care by IRQF_ONESHOT flag. Remove
the primary interrupt handler and disable the interrupt in the
interrupt thread function.

Change-Id: I6c607e0cdef09ffe4f758f9498ee6241d099ee26
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
2016-03-23 21:15:27 -07:00
Ram Chandrasekar
1271a44387 msm: limits: update the snprintf error handling
Update the snprintf() error handling in the
available_level_get() function to look for proper error
return value and take appropriate action.

Change-Id: Ifbe6450693a282105d9fddd02a756ae53d8cd892
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
2016-03-23 21:15:26 -07:00
Ram Chandrasekar
5c6e81fff6 msm: lmh_lite: Fix configurability for LMH software polling
Update the lmh hardware driver to get the polling interval
value from the lmh interface driver, instead of using a local
static variable.

LMH interface driver already exposes debug interface to
configure the interval value.

Change-Id: Ie7d91519f197930ca513b30a671d8f6917d636b0
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
2016-03-23 21:15:25 -07:00
Manaf Meethalavalappu Pallikunhi
ff76e3f64e msm: thermal: Initialize Vdd scaling max frequency variable
Currently Vdd scaling max frequency variable is not initialized,
which leads to wrong aggregation of thermal cpu scaling max frequency
request especially during KTM boot up mitigation. Initialize low
temperature scaling max frequency variable to UINT_MAX at
probe function.

Change-Id: I0220b9390cac33d40af0e4419d7451553ba6c5b5
Signed-off-by: Manaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
2016-03-23 21:13:59 -07:00
Ram Chandrasekar
ae0367e557 thermal-core: Use rcu when accessing threshold list
Threshold list will be read in interrupt context. Using
a lock in the interrupt context is not acceptable, but the
list traversal needs to be protected. Because the threshold
list can be updated with a new threshold or an existing
threshold can be removed. Doing a list traversal during the
list mutation may result in unassigned memory access
violation. Use of list_for_each_entry_safe() function for
traversing, won't help. Because this function can help
only if the traversal loop removes the current element, that
is pointed by this iteration.

Use rcu to ensure a safe list traversal without a lock.
Addition or deletion to the threshold list is an infrequent
operation when compared to the threshold list read, which
happens when temperature threshold trips. Using rcu ensures
that read operations are done faster without getting
blocked by a lock and the list write operations are done
in a list safe fashion. Replace the list_for_each_entry_safe()
function with rcu safe list traversal function
list_for_each_entry_rcu(), wherever it is applicable.

Change-Id: I7636711bfc6bd63fe3adaad38a5471e3508e240b
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
2016-03-23 21:13:07 -07:00
Ram Chandrasekar
08e81f9add msm: thermal: Use the new device framework API
Modify the thermal driver to use the new device framework API
instead of the cpu_up/cpu_down call. The new framework API, will
keep the online/offline value reported in sysfs in sync with the
actual core status. Bypassing this framework by using cpu_up/cpu_down
will not update the value reported in the sysfs.

Also protect the device framework APIs with device hotplug lock to
provide mutual exclusion between multiple drivers using the same API.

Change-Id: I55e578ec6afdcdd7537ff7afc411bd03f277d59e
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
2016-03-23 21:13:05 -07:00
Siddartha Mohanadoss
784e256994 thermal: qpnp-adc-tm: Enable VADC_TM
This snapshot is taken as of msm-3.18 commit dbdb6776f
(Merge "msm: camera: Add dummy sub module in sensor pipeline")

Fixup compilation to support int type for temperature
value as part of thermal ops API upgrade.

Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2016-03-22 11:10:50 -07:00
Siddartha Mohanadoss
2021d15137 thermal: tsens: Enable TSENS
This snapshot is taken as of msm-3.18 commit dbdb6776f
(Merge "msm: camera: Add dummy sub module in sensor pipeline")

Commit 0b46b8a7 (clocksource: arch_timer: Fix code to use
physical timers when requested) introduces the use of
physical counters and requires clients to use api
arch_counter_get_cntvct(). Accordingly update tsens_poll()
to the new API to prevent a BUG_ON() during bootup.

Fixup TSENS to use supported int type for temperature value.

Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2016-03-22 11:10:25 -07:00
Mahesh Sivasubramanian
b68798fafa soc: qcom: Snapshot of thermal/LMH drivers
This snapshot is taken as of msm-3.18 commit e70ad0c (Promotion of
kernel.lnx.3.18-151201.)

Include necessary thermal_core changes to convert long to int inline with
upstream kernel changes.

Change-Id: I642b666518fe72385794b743989a0f5e5120ec03

Conflicts:
	drivers/thermal/Makefile
2016-03-22 11:08:34 -07:00
Siddartha Mohanadoss
7a587d7f46 thermal: thermal_sys: Add support for configurable trip points.
Add functionality for configurable hi, low and critical low.
Change the trip point attributes to allow userspace clients
with root access to set temperature for configurable hi and
low temperature.

Change-Id: I25c9c3bcfd58e44da5369187d1095559062f1860
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
2016-03-22 11:08:28 -07:00