summaryrefslogtreecommitdiffstats
path: root/drivers/mfd/db8500-prcmu.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-09-23 22:37:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-09-23 22:37:49 -0400
commit4c07e2ddab5b6b57dbcb09aedbda1f484d5940cc (patch)
tree531c3121c4d1502c98d5a18903bac50b6d5be1b3 /drivers/mfd/db8500-prcmu.c
parentd0b3cfee333eb7eecb6ce72f06f5a02d249b9bdf (diff)
parent8391c6cb2414d9a75bbe247a838d28cb0cee77ee (diff)
Merge tag 'mfd-next-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
Pull MFD updates from Lee Jones: "New Drivers: - Add support for Merrifield Basin Cove PMIC New Device Support: - Add support for Intel Tiger Lake to Intel LPSS PCI - Add support for Intel Sky Lake to Intel LPSS PCI - Add support for ST-Ericsson DB8520 to DB8500 PRCMU New Functionality: - Add RTC and PWRC support to MT6323 Fix-ups: - Clean-up include files; davinci_voicecodec, asic3, sm501, mt6397 - Ignore return values from debugfs_create*(); ab3100-*, ab8500-debugfs, aat2870-core - Device Tree changes; rn5t618, mt6397 - Use new I2C API; tps80031, 88pm860x-core, ab3100-core, bcm590xx, da9150-core, max14577, max77693, max77843, max8907, max8925-i2c, max8997, max8998, palmas, twl-core, - Remove obsolete code; da9063, jz4740-adc - Simplify semantics; timberdale, htc-i2cpld - Add 'fall-through' tags; omap-usb-host, db8500-prcmu - Remove superfluous prints; ab8500-debugfs, db8500-prcmu, fsl-imx25-tsadc, intel_soc_pmic_bxtwc, qcom_rpm, sm501 - Trivial rename/whitespace/typo fixes; mt6397-core, MAINTAINERS - Reorganise code structure; mt6397-* - Improve code consistency; intel-lpss - Use MODULE_SOFTDEP() helper; intel-lpss - Use DEFINE_RES_*() helpers; mt6397-core Bug Fixes: - Clean-up resources; max77620 - Prevent input events being dropped on resume; intel-lpss-pci - Prevent sleeping in IRQ context; ezx-pcap" * tag 'mfd-next-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (48 commits) mfd: mt6323: Add MT6323 RTC and PWRC mfd: mt6323: Replace boilerplate resource code with DEFINE_RES_* macros mfd: mt6397: Add mutex include dt-bindings: mfd: mediatek: Add MT6323 Power Controller dt-bindings: mfd: mediatek: Update RTC to include MT6323 dt-bindings: mfd: mediatek: mt6397: Change to relative paths mfd: db8500-prcmu: Support the higher DB8520 ARMSS mfd: intel-lpss: Use MODULE_SOFTDEP() instead of implicit request mfd: htc-i2cpld: Drop check because i2c_unregister_device() is NULL safe mfd: sm501: Include the GPIO driver header mfd: intel-lpss: Add Intel Skylake ACPI IDs mfd: intel-lpss: Consistently use GENMASK() mfd: Add support for Merrifield Basin Cove PMIC mfd: ezx-pcap: Replace mutex_lock with spin_lock mfd: asic3: Include the right header MAINTAINERS: altera-sysmgr: Fix typo in a filepath mfd: mt6397: Extract IRQ related code from core driver mfd: mt6397: Rename macros to something more readable mfd: Remove dev_err() usage after platform_get_irq() mfd: db8500-prcmu: Mark expected switch fall-throughs ...
Diffstat (limited to 'drivers/mfd/db8500-prcmu.c')
-rw-r--r--drivers/mfd/db8500-prcmu.c44
1 files changed, 36 insertions, 8 deletions
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
index 90e0f21bc49c..0e019cc5da42 100644
--- a/drivers/mfd/db8500-prcmu.c
+++ b/drivers/mfd/db8500-prcmu.c
@@ -1695,21 +1695,41 @@ static long round_clock_rate(u8 clock, unsigned long rate)
1695 return rounded_rate; 1695 return rounded_rate;
1696} 1696}
1697 1697
1698static const unsigned long armss_freqs[] = { 1698static const unsigned long db8500_armss_freqs[] = {
1699 200000000, 1699 200000000,
1700 400000000, 1700 400000000,
1701 800000000, 1701 800000000,
1702 998400000 1702 998400000
1703}; 1703};
1704 1704
1705/* The DB8520 has slightly higher ARMSS max frequency */
1706static const unsigned long db8520_armss_freqs[] = {
1707 200000000,
1708 400000000,
1709 800000000,
1710 1152000000
1711};
1712
1713
1714
1705static long round_armss_rate(unsigned long rate) 1715static long round_armss_rate(unsigned long rate)
1706{ 1716{
1707 unsigned long freq = 0; 1717 unsigned long freq = 0;
1718 const unsigned long *freqs;
1719 int nfreqs;
1708 int i; 1720 int i;
1709 1721
1722 if (fw_info.version.project == PRCMU_FW_PROJECT_U8520) {
1723 freqs = db8520_armss_freqs;
1724 nfreqs = ARRAY_SIZE(db8520_armss_freqs);
1725 } else {
1726 freqs = db8500_armss_freqs;
1727 nfreqs = ARRAY_SIZE(db8500_armss_freqs);
1728 }
1729
1710 /* Find the corresponding arm opp from the cpufreq table. */ 1730 /* Find the corresponding arm opp from the cpufreq table. */
1711 for (i = 0; i < ARRAY_SIZE(armss_freqs); i++) { 1731 for (i = 0; i < nfreqs; i++) {
1712 freq = armss_freqs[i]; 1732 freq = freqs[i];
1713 if (rate <= freq) 1733 if (rate <= freq)
1714 break; 1734 break;
1715 } 1735 }
@@ -1854,11 +1874,21 @@ static int set_armss_rate(unsigned long rate)
1854{ 1874{
1855 unsigned long freq; 1875 unsigned long freq;
1856 u8 opps[] = { ARM_EXTCLK, ARM_50_OPP, ARM_100_OPP, ARM_MAX_OPP }; 1876 u8 opps[] = { ARM_EXTCLK, ARM_50_OPP, ARM_100_OPP, ARM_MAX_OPP };
1877 const unsigned long *freqs;
1878 int nfreqs;
1857 int i; 1879 int i;
1858 1880
1881 if (fw_info.version.project == PRCMU_FW_PROJECT_U8520) {
1882 freqs = db8520_armss_freqs;
1883 nfreqs = ARRAY_SIZE(db8520_armss_freqs);
1884 } else {
1885 freqs = db8500_armss_freqs;
1886 nfreqs = ARRAY_SIZE(db8500_armss_freqs);
1887 }
1888
1859 /* Find the corresponding arm opp from the cpufreq table. */ 1889 /* Find the corresponding arm opp from the cpufreq table. */
1860 for (i = 0; i < ARRAY_SIZE(armss_freqs); i++) { 1890 for (i = 0; i < nfreqs; i++) {
1861 freq = armss_freqs[i]; 1891 freq = freqs[i];
1862 if (rate == freq) 1892 if (rate == freq)
1863 break; 1893 break;
1864 } 1894 }
@@ -3130,10 +3160,8 @@ static int db8500_prcmu_probe(struct platform_device *pdev)
3130 writel(ALL_MBOX_BITS, PRCM_ARM_IT1_CLR); 3160 writel(ALL_MBOX_BITS, PRCM_ARM_IT1_CLR);
3131 3161
3132 irq = platform_get_irq(pdev, 0); 3162 irq = platform_get_irq(pdev, 0);
3133 if (irq <= 0) { 3163 if (irq <= 0)
3134 dev_err(&pdev->dev, "no prcmu irq provided\n");
3135 return irq; 3164 return irq;
3136 }
3137 3165
3138 err = request_threaded_irq(irq, prcmu_irq_handler, 3166 err = request_threaded_irq(irq, prcmu_irq_handler,
3139 prcmu_irq_thread_fn, IRQF_NO_SUSPEND, "prcmu", NULL); 3167 prcmu_irq_thread_fn, IRQF_NO_SUSPEND, "prcmu", NULL);