Skip to content

Hikey960 4.9 pm fixes v3 #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

Leo-Yan
Copy link

@Leo-Yan Leo-Yan commented Jul 6, 2017

This patch set is to fix power management related code; the first two patches are to align code base for thermal and stub clock; and last four patches are ported GPU devfreq driver. Has been verified on Hikey960.

Leo Yan and others added 30 commits June 21, 2017 10:48
Add stub clock driver for Hi3660, this patch registers clock node for
big and LITTLE clusters and GPU clock. For DDR clock, it's should
partially supported but has not been verified yet.

Signed-off-by: Leo Yan <[email protected]>
After send message to MCU to change the frequency, the MCU writes the
real frequency value into the shared memory. So this patch is to read
back the frequency value for CPU, DDR and GPU from shared memory.

Change-Id: Icc25fcf8675b06f4b7586e4cda03164d606199a7
Signed-off-by: Tao Wang <[email protected]>
Signed-off-by: Leo Yan <[email protected]>
This patch is to add thermal driver for Hi3660, the thermal driver is to
read temperature value from MCU by using mailbox.

Change-Id: Ibbd2da63c0b34e0a8dfa990509465e0fc9044855
Signed-off-by: Tao Wang <[email protected]>
Signed-off-by: Leo Yan <[email protected]>
[ Upstream commit c61b781 ]

There exists a race when msg_submit return immediately as there was an
active request being processed which may have completed just before it's
checked again in mbox_send_message. This will result in return to the
caller without waiting in mbox_send_message even when it's blocking Tx.

This patch fixes the issue by waiting for the completion always if Tx
is in blocking mode.

Change-Id: Ied20ee933ae4e0c1d199e373d112cdef370f2815
Fixes: 2b6d83e ("mailbox: Introduce framework for mailbox")
Reported-by: Alexey Klimov <[email protected]>
Signed-off-by: Sudeep Holla <[email protected]>
Reviewed-by: Alexey Klimov <[email protected]>
Signed-off-by: Jassi Brar <[email protected]>
Signed-off-by: Leo Yan <[email protected]>
[ Upstream commit cc6eeaa ]

If a wait_for_completion_timeout() call returns due to a timeout,
complete() can get called after returning from the wait which is
incorrect and can cause subsequent transmissions on a channel to fail.
Since the wait_for_completion_timeout() sees the completion variable
is non-zero caused by the erroneous/spurious complete() call, and
it immediately returns without waiting for the time as expected by the
client.

This patch fixes the issue by skipping complete() call for the timer
expiry.

Change-Id: Ifd27aa51f3bb4186010a30a1988355492113f8db
Fixes: 2b6d83e ("mailbox: Introduce framework for mailbox")
Reported-by: Alexey Klimov <[email protected]>
Signed-off-by: Sudeep Holla <[email protected]>
Signed-off-by: Jassi Brar <[email protected]>
[ Upstream commit cb710ab ]

We already check if the message is empty before calling the client
tx_done callback. Calling completion on a wait event is also invalid
if the message is empty.

This patch moves the existing empty message check earlier.

Change-Id: I59aac3b2c133fecf2fb9e7746fa5ec72f391288c
Fixes: 2b6d83e ("mailbox: Introduce framework for mailbox")
Signed-off-by: Sudeep Holla <[email protected]>
Signed-off-by: Jassi Brar <[email protected]>
In prevous commit, stub_clock dts is backported from v4.12. However, it
makes kernel hang at boot.

Changing stub_clock's reg property back to what aosp V4.4 uses can sovle
this issue. But need more reasoning about why.

Signed-off-by: Guodong Xu <[email protected]>
Add OPP table for CPU nodes.

Signed-off-by: Leo Yan <[email protected]>
This patch adds thermal zone to bind thermal sensor with CPU cooling
device, for supporting thermal IPA governor this patch adds
'sustainable-power', 'dynamic coefficient' and 'weight' parameters.

Signed-off-by: Tao Wang <[email protected]>
Signed-off-by: Leo Yan <[email protected]>
Add "hisilicon,hi3660-reboot" node for hi3660.

DOUBLECHECK: need to know whether this can be dropped. We are now using
 syscon-reboot-mode.

Signed-off-by: Chen Feng <[email protected]>
Signed-off-by: Chen Jun <[email protected]>
Add hi3660-drm.dtsi
Add adv7533 node under i2c1

Signed-off-by: Chen Feng <[email protected]>
Signed-off-by: Liwei Cai <[email protected]>
[jstultz: Rework patchset to use upstream adv7511 and remove duplicated code]
Signed-off-by: John Stultz <[email protected]>
[guodong: split dts and rebase to mainline]
[guodong: fix: adv7533 v1p2-supply to ldo3]
[guodong: fix: file mode should be 644]
Signed-off-by: Guodong Xu <[email protected]>
ION dts bits needed

Signed-off-by: John Stultz <[email protected]>
Add entries to reserved-memory, porting from v4.4 aosp branch

Signed-off-by: John Stultz <[email protected]>
Signed-off-by: Guodong Xu <[email protected]>
… obsolete

Method of kim and btwilink is still in use in v4.9 kernel, so add them here.

However, in mainline kernel starting from v4.12, bluetooth are connected
through serdev, where this patch will be  obsolete.

Signed-off-by: Guodong Xu <[email protected]>
This patch is to enable energy model parameters for P-states and
C-states. So use it to enable energy aware scheduling.

Signed-off-by: Leo Yan <[email protected]>
Signed-off-by: John Stultz <[email protected]>
In HI3660, SPI2 belongs to secure world by default. Accessing spi2 in kernel
causes CPU mode error.

To fix that, need to grant access to normal world in xloader. An updated
xloader is now available at master of
  https://github.com/96boards-hikey/tools-images-hikey960

Need to submit it to AOSP as well. After submitted to AOSP, this commit
can be dropped.

Signed-off-by: Guodong Xu <[email protected]>
…60-upstream-rebase-v4.9-2017-07-06-11-02-50

* working-hikey960-upstream-dts-v4.9: (48 commits)
  TEMP: dts: arm64: hi3660: disable spi2, xloader update pending
  dts: hi3660: Add EAS energy model provide big.LITTLE info
  arm64: dts: hi3660-hikey960: add kim and btwilink nodes for bluetooth obsolete
  arm64: dts: hi3660-hikey960: add entries to reserved-memory
  arm64: dts: hi3660: add ION dts entries
  arm64: dts: hi3660: Add hdmi audio support
  arm64: dts: hi3660: add hisilicon DRM and adv7533 node
  DOUBLECHECK: arm64: dts: hi3660: adb reboot node
  dts: arm64: add thermal zone for Hi3660
  dts: arm64: bind CPUs OPP table for Hi3660
  HACK: dts: arm64: hi3660: fix: change stub_clock reg back
  dts: arm64: bind stub clock driver for Hi3660
  dts: arm64: add mailbox binding for hi3660
  arm64: dts: hikey960: Add pstore support
  arm64: dts: hikey960: Add support for syscon-reboot-mode
  arm64: dts: enable gpu
  TODO: arm64: dts: hi3660: add usb nodes for hikey960
  arm64: dts: Add ufs dts node
  dt-bindings: scsi: ufs: add document for hi3660-ufs
  arm64: dts: register Hi3660's thermal sensor
  ...
…60-upstream-rebase-v4.9-2017-07-06-11-02-50

* working-hikey960-upstream-clk-v4.9:
  clk: Hi3660: read frequency from shared memory
  clk: hisilicon: add stub clock driver for Hi3660
  clk: Hi3660: register fixed_rate_clks with CLK_OF_DECLARE_DRIVER
  clk: hi3660: Set PPLL2 to 2880M
  clk: hi3660: add clocks for video encoder, decoder and ISP
  clk: hi3660: fix wrong parent name of clk_mux_sysbus
  clk: hisilicon: Add clock driver for hi3660 SoC
  dt-bindings: Document the hi3660 clock bindings
  clk: hisilicon: fix lock assignment
…60-upstream-rebase-v4.9-2017-07-06-11-02-50

* working-hikey960-upstream-usb-v4.9: (371 commits)
  HACK: usb: compilation err: backporting usb from v4.12-rc5 to v4.9
  usb: add pd support for hikey960
  usb: add dwc3 driver for hikey960
  usb: add hub_usb5734 driver for hikey960
  usb: xhci: use bus->sysdev for DMA configuration
  usb: separate out sysdev pointer from usb_bus
  usb: typec: add driver for Intel Whiskey Cove PMIC USB Type-C PHY
  usb: USB Type-C connector class
  USB: gadget: fix GPF in gadgetfs
  usb: gadget: composite: make sure to reactivate function on unbind
  usb: gadget: udc: renesas_usb3: Fix PN_INT_ENA disabling timing
  usb: gadget: udc: renesas_usb3: lock for PN_ registers access
  usb: gadget: udc: renesas_usb3: fix deadlock by spinlock
  usb: gadget: udc: renesas_usb3: fix pm_runtime functions calling
  usb: gadget: f_mass_storage: Serialize wake and sleep execution
  usb: dwc2: add support for the DWC2 controller on Meson8 SoCs
  usb: dwc3: keystone: check return value
  usb: gadget: f_fs: avoid out of bounds access on comp_desc
  usb: gadget: gserial: check if console kthread exists
  usb: dwc3: gadget: Prevent losing events in event cache
  ...
…y960-upstream-rebase-v4.9-2017-07-06-11-02-50

* working-hikey960-upstream-reset-v4.9:
  DOUBLECHECK: reset: hisi-reboot: adb reboot bootloader
  i2c: designware: add reset interface
  reset: hisilicon: add reset-hi3660
  dt-bindings: Document the hi3660 reset bindings
…ing-hikey960-upstream-rebase-v4.9-2017-07-06-11-02-50

* working-hikey960-upstream-mfd-regulator-v4.9:
  regulator: hi6421v530: Describe consumed platform device
  regulator: hi6421v530: add driver for hi6421v530 voltage regulator
  regulator: hi6421: Describe consumed platform device
  mfd: hi6421-pmic: add support for HiSilicon Hi6421v530
  mfd: hi6421-pmic: cleanup: update dev_err messages
  mfd: hi6421-pmic: cleanup: change license text to shorter form
…60-upstream-rebase-v4.9-2017-07-06-11-02-50

* working-hikey960-upstream-ufs-v4.9:
  scsi:ufs:add hi3660 ufs driver code
  scsi:ufs:add AHIT for hi3660 ufs
…0-upstream-rebase-v4.9-2017-07-06-11-02-50

* working-hikey960-upstream-sd-v4.9:
  mmc: dw_mmc-k3: add sd support for hi3660
…960-upstream-rebase-v4.9-2017-07-06-11-02-50

* working-hikey960-upstream-mali-v4.9:
  drivers: gpu: add gpu part11
  drivers: gpu: add gpu part10
  drivers: gpu: add gpu part9
  drivers: gpu: add gpu part8
  drivers: gpu: add gpu part7
  drivers: gpu: add gpu part6
  drivers: gpu: add gpu part5
  drivers: gpu: add gpu part4
  drivers: gpu: add gpu part3
  drivers: gpu: add gpu part2
  drivers: gpu: add gpu part1
  drivers: gpu: set drivers Kconfig and gpu Makefile
…960-upstream-rebase-v4.9-2017-07-06-11-02-50

* working-hikey960-upstream-pcie-v4.9:
  PCI: kirin: add PCIe drivers for hisilicon Kirin SoC
…0-upstream-rebase-v4.9-2017-07-06-11-02-50

* working-hikey960-upstream-pm-v4.9:
  mailbox: handle empty message in tx_tick
  mailbox: skip complete wait event if timer expired
  mailbox: always wait in mbox_send_message for blocking Tx mode
  thermal: Hi3660: add thermal driver
  mailbox: Hi3660: add support for async mode
  cpufreq: hisi-acpu: add support for hi3660
  driver: mailbox: add support for hi3660
  cpuidle: hisi-cpuidle: add hisilicon cpuidle driver
…hikey960-upstream-rebase-v4.9-2017-07-06-11-02-50

* working-hikey960-upstream-bluetooth-v4.9:
  ti-st: Build fixup for 4.9
  ti-st: tty_hci: fix user space access
  Bluetooth: Add LED triggers for bluetooth packet receive and transmit
  misc: ti-st: Fix build warnings
  Revert "Revert "ti-st: add device tree support""
  Bluetooth: Add tty HCI driver
  btwilink: add minimal device tree support
…ey960-upstream-rebase-v4.9-2017-07-06-11-02-50

* working-hikey960-upstream-binder-v4.9:
  binder: Add support for file-descriptor arrays
  binder: Add support for scatter-gather
  binder: Add extra size to allocator
  binder: Refactor binder_transact()
  binder: Support multiple /dev instances
  binder: Deal with contexts in debugfs
  binder: Support multiple context managers
  binder: Split flat_binder_object
…hikey960-upstream-rebase-v4.9-2017-07-06-11-02-50

* working-hikey960-upstream-hack-aosp-v4.9:
  MALI: HACK: Revert Sync api changes to v4.5
  HACK: ion: Revert all ion code back to android-hikey-linaro-4.4
  HACK: Use CAP_SYS_NICE instead of CAP_CGROUP for now
docularxu and others added 11 commits July 6, 2017 11:03
…key960-upstream-rebase-v4.9-2017-07-06-11-02-50

* working-hikey960-upstream-adv7511-v4.9:
  HACK: adv7511: Add delay to allow for edid probing to work
  Add adv7511 changes from android-hikey-linaro-4.9 branch
…60-upstream-rebase-v4.9-2017-07-06-11-02-50

* working-hikey960-upstream-drm-v4.9:
  iommu: iommu code changes
  HACK: drm: kirin960: Build fixups and changes to make it work
  kirin_fbdev: Eat FBIO_WAITFORVSYNC ioctl to avoid errors
  drm: resolve the performance issue by interrupt mechanism
  drm: hisilicon: solve tearing issue of display
  drm: solve display underflow at 1280x800@60fps
  drm: Add hisilicon DRM driver for hikey960
…y960-upstream-rebase-v4.9-2017-07-06-11-02-50

* working-hikey960-upstream-sound-v4.9:
  Sound: Remove deprecated code, as power supply is already enabled in fastboot
  sound: Add hisi i2s audio driver
…hikey960-upstream-rebase-v4.9-2017-07-06-11-02-50

* working-hikey960-upstream-defconfig-v4.9:
  hikey960_defconfig: append CPUFREQ configs
  hikey960_defconfig: append CONFIG_CPU_IDLE_MULTIPLE_DRIVERS configs
  hikey960_defconfig: append F2FS and SQUASHFS configs
  hikey960_defconfig: append MALI configs
  hikey960_defconfig: append USB configs
  hikey960_defconfig: add configs for thermal sensor
  arm64: defconfig: add configs for thermal sensor
  hikey960_defconfig: Add initial defconfig
  arm64: defconfig: enable usb for hikey960
  arm64: defconfig: enable power management for Hi3660
  arm64: defconfig: PCI: add PCIe drivers defconfig for hisilicon Kirin SoC
  arm64: defconfig: enable Mali GPU
  arm64: defconfig: enable f2fs and squashfs
  arm64: defconfig: enable configs for hi3660 ufs
  arm64: defconfig: enable support hi6421v530 PMIC
Read sensor value directly from register
add two virtual sensors, one for average of all sensors,
one for max of all sensors
remove unnecessary mutex lock

Signed-off-by: Tao Wang <[email protected]>
Signed-off-by: Leo Yan <[email protected]>
resort and simplify clk stub code
remove freq table inside this driver
remove unused clock-name property
correct ddr set freq cmd

Signed-off-by: Tao Wang <[email protected]>
update pm_opp interface, fix building error
clk get use dt binding, remove the specified clk name in the code
recalc current frequency when set new target or get current frequency

Signed-off-by: Tao Wang <[email protected]>
Remove unused platform code

Signed-off-by: Tao Wang <[email protected]>
add gpu clk node
add gpu power model parameters
add gpu cooling device to thermal zone

Signed-off-by: Tao Wang <[email protected]>
Enable mali gpu devfreq and thermal cooling On HiKey960

Signed-off-by: Tao Wang <[email protected]>
Enable mali gpu devfreq and thermal cooling On HiKey960

Signed-off-by: Leo Yan <[email protected]>
@docularxu
Copy link

Thanks Leo. Cherry-picked to topic branches:
working-hikey960-upstream-dts-v4.9
working-hikey960-upstream-clk-v4.9
working-hikey960-upstream-pm-v4.9
working-hikey960-upstream-mali-v4.9
working-hikey960-upstream-defconfig-v4.9

Integrated to hikey960-v4.9

@docularxu docularxu closed this Jul 6, 2017
@Leo-Yan Leo-Yan deleted the hikey960-4.9-pm-fixes_v3 branch March 17, 2020 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants