[PATCH v5 0/2] Introducing Exynos ChipId driver
This patch series introduces Exynos Chipid platform driver. Each Exynos SoC has ChipID block which can give information about SoC's product Id and revision number. At the same time it reduces dependency of mach-exynos files from plat-samsung, by removing samsung_rev API, similar API is introduced in chipid driver itself to get revision number and product id. This patch series is based on Kukjin Kim's for-next having SHA_ID: 9db7d78aca2c7fbc19a26ce2ef01c805dc010c72 It can also be cleanly applied on latest (next-20141209) linux-next. This has been tested against both tree on Exynos3250 and Exynos5250 (SMDK) board. Revision 4 and it's discussion can be found here - https://lkml.org/lkml/2014/12/3/115 Changes since v4: - Removed custom sysfs entries as they were not providing any new information as pointed out by Arnd. - Removed functions exporting product_id and revision, instead we will export exynos_chipid_info structure. It will be helpfull when we need to provide more fields of chipid outside of chipid, as commented by Yadwinder - Converted all funcions as __init. Change since v3: - This patch set contains 5/6 and 6/6 patch from v3 series. - Made EXYNOS_CHIPID config option non-user selectable, as suggested by Tomasz Figa. - Made uniform macro for EXYNOS4/5_SOC_MASK as EXYNOS_SOC_MASK as suggested by Tomasz Figa. - Made local variables static in chipid driver. - Added existing SoC's product id's. - Added platform driver support. Changes since v2: - Reorganized patches as suggested by Tomasz Figa. - Addressed review comments of Tomasz Figa in i2c-s3c2410.c file. Changes since v1: - Added patch to move i2c interrupt re-configuration code from exynos.c to i2c driver, as suggested by Arnd. - After above patch only user of SYS_I2C_CFG register is pm.c so moving save/restore of this register also into i2c driver. - Spiltted up exynos4 and exynos5 machine descriptors to get rid from soc_is_exynos4/exynos5 kind of macros, as suggested by Arnd. - Changed location of chipid driver to drivers/soc. - Added drivers/base/soc.c provided infrastructure to make SoC specific information avaible to user space via sysfs entry, as suggested by Arnd. Pankaj Dubey (2): soc: samsung: add exynos chipid driver support ARM: EXYNOS: refactoring of mach-exynos to enable chipid driver arch/arm/mach-exynos/Kconfig | 2 + arch/arm/mach-exynos/common.h| 54 - arch/arm/mach-exynos/exynos.c| 77 +--- arch/arm/mach-exynos/include/mach/map.h | 2 - arch/arm/mach-exynos/platsmp.c | 2 +- arch/arm/mach-exynos/pm.c| 8 +- arch/arm/plat-samsung/cpu.c | 14 --- arch/arm/plat-samsung/include/plat/cpu.h | 2 - arch/arm/plat-samsung/include/plat/map-s5p.h | 1 - drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/samsung/Kconfig | 14 +++ drivers/soc/samsung/Makefile | 1 + drivers/soc/samsung/exynos-chipid.c | 168 +++ include/linux/soc/samsung/exynos-soc.h | 51 15 files changed, 296 insertions(+), 102 deletions(-) create mode 100644 drivers/soc/samsung/Kconfig create mode 100644 drivers/soc/samsung/Makefile create mode 100644 drivers/soc/samsung/exynos-chipid.c create mode 100644 include/linux/soc/samsung/exynos-soc.h -- 2.2.0 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 2/2] ARM: EXYNOS: refactoring of mach-exynos to enable chipid driver
This patch enables chipid driver for ARCH_EXYNOS and refactors machine code for using chipid driver for identification of SoC ID and SoC rev. Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com --- arch/arm/mach-exynos/Kconfig | 2 + arch/arm/mach-exynos/common.h| 54 --- arch/arm/mach-exynos/exynos.c| 77 +++- arch/arm/mach-exynos/include/mach/map.h | 2 - arch/arm/mach-exynos/platsmp.c | 2 +- arch/arm/mach-exynos/pm.c| 8 +-- arch/arm/plat-samsung/cpu.c | 14 - arch/arm/plat-samsung/include/plat/cpu.h | 2 - arch/arm/plat-samsung/include/plat/map-s5p.h | 1 - 9 files changed, 60 insertions(+), 102 deletions(-) diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig index b9e3f1c..dd656a4 100644 --- a/arch/arm/mach-exynos/Kconfig +++ b/arch/arm/mach-exynos/Kconfig @@ -25,6 +25,8 @@ menuconfig ARCH_EXYNOS select S5P_DEV_MFC select SRAM select MFD_SYSCON + select SOC_SAMSUNG + select EXYNOS_CHIPID help Support for SAMSUNG EXYNOS SoCs (EXYNOS4/5) diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index 865f878..107b2c8 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -13,39 +13,26 @@ #define __ARCH_ARM_MACH_EXYNOS_COMMON_H #include linux/of.h +#include linux/soc/samsung/exynos-soc.h -#define EXYNOS3250_SOC_ID 0xE3472000 -#define EXYNOS3_SOC_MASK 0xF000 - -#define EXYNOS4210_CPU_ID 0x4321 -#define EXYNOS4212_CPU_ID 0x4322 -#define EXYNOS4412_CPU_ID 0xE4412200 -#define EXYNOS4_CPU_MASK 0xFFFE - -#define EXYNOS5250_SOC_ID 0x4352 -#define EXYNOS5410_SOC_ID 0xE541 -#define EXYNOS5420_SOC_ID 0xE542 -#define EXYNOS5440_SOC_ID 0xE544 -#define EXYNOS5800_SOC_ID 0xE5422000 -#define EXYNOS5_SOC_MASK 0xF000 - -extern unsigned long samsung_cpu_id; +static inline u32 exynos_product_id(void); #define IS_SAMSUNG_CPU(name, id, mask) \ static inline int is_samsung_##name(void) \ { \ - return ((samsung_cpu_id mask) == (id mask));\ + u32 product_id = exynos_product_id(); \ + return ((product_id mask) == (id)); \ } -IS_SAMSUNG_CPU(exynos3250, EXYNOS3250_SOC_ID, EXYNOS3_SOC_MASK) -IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK) -IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK) -IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK) -IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK) -IS_SAMSUNG_CPU(exynos5410, EXYNOS5410_SOC_ID, EXYNOS5_SOC_MASK) -IS_SAMSUNG_CPU(exynos5420, EXYNOS5420_SOC_ID, EXYNOS5_SOC_MASK) -IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK) -IS_SAMSUNG_CPU(exynos5800, EXYNOS5800_SOC_ID, EXYNOS5_SOC_MASK) +IS_SAMSUNG_CPU(exynos3250, EXYNOS3250_SOC_ID, EXYNOS_SOC_MASK) +IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_SOC_ID, EXYNOS_SOC_MASK) +IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_SOC_ID, EXYNOS_SOC_MASK) +IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_SOC_ID, EXYNOS_SOC_MASK) +IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS_SOC_MASK) +IS_SAMSUNG_CPU(exynos5410, EXYNOS5410_SOC_ID, EXYNOS_SOC_MASK) +IS_SAMSUNG_CPU(exynos5420, EXYNOS5420_SOC_ID, EXYNOS_SOC_MASK) +IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS_SOC_MASK) +IS_SAMSUNG_CPU(exynos5800, EXYNOS5800_SOC_ID, EXYNOS_SOC_MASK) #if defined(CONFIG_SOC_EXYNOS3250) # define soc_is_exynos3250() is_samsung_exynos3250() @@ -71,10 +58,6 @@ IS_SAMSUNG_CPU(exynos5800, EXYNOS5800_SOC_ID, EXYNOS5_SOC_MASK) # define soc_is_exynos4412() 0 #endif -#define EXYNOS4210_REV_0 (0x0) -#define EXYNOS4210_REV_1_0 (0x10) -#define EXYNOS4210_REV_1_1 (0x11) - #if defined(CONFIG_SOC_EXYNOS5250) # define soc_is_exynos5250() is_samsung_exynos5250() #else @@ -150,8 +133,15 @@ extern void exynos_pm_central_suspend(void); extern int exynos_pm_central_resume(void); extern void exynos_enter_aftr(void); -extern void s5p_init_cpu(void __iomem *cpuid_addr); -extern unsigned int samsung_rev(void); +static inline u32 exynos_product_id(void) +{ + return exynos_soc_info.product_id; +} + +static inline u32 exynos_revision(void) +{ + return exynos_soc_info.revision; +} static inline void pmu_raw_writel(u32 val, u32 offset) { diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index c13d083..e2a640b 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -126,53 +126,16 @@ static void __init exynos_init_late(void) exynos_pm_init(); } -static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname, - int depth, void *data) +static void __init exynos4_init_io(void) { - struct map_desc
[PATCH v5 1/2] soc: samsung: add exynos chipid driver support
Exynos SoCs have Chipid, for identification of product IDs and SoC revisions. This patch intendes to provide initialization code for all these functionalites. This driver usese existing binding for exnos-chipid. CC: Grant Likely grant.lik...@linaro.org CC: Rob Herring robh...@kernel.org CC: Linus Walleij linus.wall...@linaro.org Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com --- drivers/soc/Kconfig| 1 + drivers/soc/Makefile | 1 + drivers/soc/samsung/Kconfig| 14 +++ drivers/soc/samsung/Makefile | 1 + drivers/soc/samsung/exynos-chipid.c| 168 + include/linux/soc/samsung/exynos-soc.h | 51 ++ 6 files changed, 236 insertions(+) create mode 100644 drivers/soc/samsung/Kconfig create mode 100644 drivers/soc/samsung/Makefile create mode 100644 drivers/soc/samsung/exynos-chipid.c create mode 100644 include/linux/soc/samsung/exynos-soc.h diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig index 76d6bd4..c3abfbe 100644 --- a/drivers/soc/Kconfig +++ b/drivers/soc/Kconfig @@ -1,6 +1,7 @@ menu SOC (System On Chip) specific Drivers source drivers/soc/qcom/Kconfig +source drivers/soc/samsung/Kconfig source drivers/soc/ti/Kconfig source drivers/soc/versatile/Kconfig diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile index 063113d..620366f 100644 --- a/drivers/soc/Makefile +++ b/drivers/soc/Makefile @@ -3,6 +3,7 @@ # obj-$(CONFIG_ARCH_QCOM)+= qcom/ +obj-$(CONFIG_SOC_SAMSUNG) += samsung/ obj-$(CONFIG_ARCH_TEGRA) += tegra/ obj-$(CONFIG_SOC_TI) += ti/ obj-$(CONFIG_PLAT_VERSATILE) += versatile/ diff --git a/drivers/soc/samsung/Kconfig b/drivers/soc/samsung/Kconfig new file mode 100644 index 000..2d83652 --- /dev/null +++ b/drivers/soc/samsung/Kconfig @@ -0,0 +1,14 @@ +# +# SAMSUNG SoC drivers +# +menu Samsung SOC driver support + +config SOC_SAMSUNG + bool + +config EXYNOS_CHIPID + bool + depends on ARCH_EXYNOS + select SOC_BUS + +endmenu diff --git a/drivers/soc/samsung/Makefile b/drivers/soc/samsung/Makefile new file mode 100644 index 000..855ca05 --- /dev/null +++ b/drivers/soc/samsung/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_EXYNOS_CHIPID)+= exynos-chipid.o diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c new file mode 100644 index 000..8968f83 --- /dev/null +++ b/drivers/soc/samsung/exynos-chipid.c @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * http://www.samsung.com/ + * + * EXYNOS - CHIP ID support + * Author: Pankaj Dubey pankaj.du...@samsung.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/io.h +#include linux/of.h +#include linux/of_address.h +#include linux/of_platform.h +#include linux/platform_device.h +#include linux/slab.h +#include linux/sys_soc.h +#include linux/soc/samsung/exynos-soc.h + +#define EXYNOS_SUBREV_MASK (0xF 4) +#define EXYNOS_MAINREV_MASK(0xF 0) +#define EXYNOS_REV_MASK(EXYNOS_SUBREV_MASK | EXYNOS_MAINREV_MASK) + +static void __iomem *exynos_chipid_base; + +struct exynos_chipid_info exynos_soc_info; +EXPORT_SYMBOL(exynos_soc_info); + +static const char * __init product_id_to_name(unsigned int product_id) +{ + const char *soc_name; + unsigned int soc_id = product_id EXYNOS_SOC_MASK; + + switch (soc_id) { + case EXYNOS3250_SOC_ID: + soc_name = EXYNOS3250; + break; + case EXYNOS4210_SOC_ID: + soc_name = EXYNOS4210; + break; + case EXYNOS4212_SOC_ID: + soc_name = EXYNOS4212; + break; + case EXYNOS4412_SOC_ID: + soc_name = EXYNOS4412; + break; + case EXYNOS4415_SOC_ID: + soc_name = EXYNOS4415; + break; + case EXYNOS5250_SOC_ID: + soc_name = EXYNOS5250; + break; + case EXYNOS5260_SOC_ID: + soc_name = EXYNOS5260; + break; + case EXYNOS5420_SOC_ID: + soc_name = EXYNOS5420; + break; + case EXYNOS5440_SOC_ID: + soc_name = EXYNOS5440; + break; + case EXYNOS5800_SOC_ID: + soc_name = EXYNOS5800; + break; + default: + soc_name = UNKNOWN; + } + return soc_name; +} + +static const struct of_device_id of_exynos_chipid_ids[] __initconst = { + { + .compatible = samsung,exynos4210-chipid, + }, + {}, +}; + +/** + * exynos_chipid_early_init: Early chipid initialization + * @dev: pointer to chipid device + */ +void __init exynos_chipid_early_init(struct device *dev) +{ + struct device_node
Re: regression: OMAP4 (next-20141204) (bisect to: ARM: 8208/1: l2c: Refactor the driver to use commit-like)
On Wed, Dec 10, 2014 at 10:42:33AM +0100, Marek Szyprowski wrote: I assume that now it won't be possible to get l2c patches back to -next, so I will resend them (again...) with the omap related fix. What, you mean you don't know the fundamental rules of kernel development? No one should ever dump any new code into linux-next during a merge window which is not a fix for a regression or a bug fix, period. Linus has in the past taken a snapshot of linux-next at the beginning of a merge window, and then threatened to refuse to merge anything that wasn't in his local snapshot, or which doesn't qualify as the above. So no, it won't be possible, because I play by the community rules when it comes to what gets merged and at what time in the cycle. -- FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up according to speedtest.net. -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: regression: OMAP4 (next-20141204) (bisect to: ARM: 8208/1: l2c: Refactor the driver to use commit-like)
On 2014-12-11 10:29, Russell King - ARM Linux wrote: On Wed, Dec 10, 2014 at 10:42:33AM +0100, Marek Szyprowski wrote: I assume that now it won't be possible to get l2c patches back to -next, so I will resend them (again...) with the omap related fix. What, you mean you don't know the fundamental rules of kernel development? No one should ever dump any new code into linux-next during a merge window which is not a fix for a regression or a bug fix, period. Linus has in the past taken a snapshot of linux-next at the beginning of a merge window, and then threatened to refuse to merge anything that wasn't in his local snapshot, or which doesn't qualify as the above. So no, it won't be possible, because I play by the community rules when it comes to what gets merged and at what time in the cycle. I know the rules. It was just my whining, that it is yet another release cycle that got missed. It is really disappointing, that those patches have been floating for months and noone found issues related to different order of initialization. It took way to long to get them scheduled for testing in -next. Exynos4 platform cannot be considered as fully functional without proper l2cache support, but I assume that this is once again our fault that we had to modify the common l2c code. Best regards -- Marek Szyprowski, PhD Samsung RD Institute Poland -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC 04/15] regulator: add restrack support
Hi Mark, On 12/10/2014 05:07 PM, Mark Brown wrote: On Wed, Dec 10, 2014 at 04:48:22PM +0100, Andrzej Hajda wrote: Regulators supports various methods of lookup. The patch adds restrack support only to DT based regulators. Why, what does this mean and how might one use it? I've not looked at the code since I don't know what it's supposed to accomplish... Looking at this patch makes no sense without looking at cover letter or at the patch adding restrack framework. In short adding restrack support to regulators will allow to: - proper handle regulator provider unbind/re-bind, currently it results in oopses, crashes and hangs, - avoid late probe due to deferred probing, currently if probe is deferred, re-probe occurs in late initcall, - track appearance of resources which can alter behavior of the driver if present but they are not required, I am not sure if there are use cases for it in case of regulators, but other resources have such use cases, - as a bonus we can have simpler allocation of various resources, please look at cover letter for example. One very high level thing is that anything that only works for DT only seems to be a non-starter, the API should be hiding details of the firmware interface. I agree, but as this is RFC, not everything is finished. It seems I have forgotten to mention it clearly in cover letter. Anyway it seems I should adjust patchset and move matching code from restrack/track core to specific frameworks. This way any current or future lookup method should be supported. But the main purpose of this patchset is to get opinions, if the main ideas are OK. And if the patchset can be eventually accepted. Regards Andrzej -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/4] phy: samsung-usb2: Add support for Vbus regulator
This has been on my to-do list for sometime. Until now the host controller (specifically ehci-exynos) is responsible for enabling VBUS supply. This opens up one more issue which is, when only ohci-exynos is enabled and ehci-exynosis disabled then VBUS was never enabled (since ohci did not have the code to enabled the VBUS supply). Rather it should be wise to move the VBUS related stuff to phy driver and let phy take care of enabling it. This patch series adds that VBUS regulator to phy-samsung-usb2 driver, adds necessary binding information as well as vbus-supply properties to phy nodes on exynos5250 systems. Also we have removed the samsung,vbus-gpio property from usb2 (ehci) node on exynos5250 systems. **[The older code in ehci-exynos for vbus setting is left intact to keep supporting older dt bindings]. Vivek Gautam (4): Doc/devicetree: bindings: Update bindings information for USB3.0 DRD PHY phy: samsung-usb2: Add facility for VBUS supply arm: dts: exynos5250: Use regulator for USB 2.0 VBUS supply arm: dts: exynos5250: Remove vbus gpio property from usb 2.0 host .../devicetree/bindings/phy/samsung-phy.txt| 12 arch/arm/boot/dts/exynos5250-smdk5250.dts | 22 -- arch/arm/boot/dts/exynos5250-snow.dts | 22 -- drivers/phy/phy-samsung-usb2.c | 30 drivers/phy/phy-samsung-usb2.h |1 + 5 files changed, 83 insertions(+), 4 deletions(-) -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/4] Doc/devicetree: bindings: Update bindings information for USB3.0 DRD PHY
Add missing VBUS-supply information and consumer usage information for USB 3.0 DRD PHY. Signed-off-by: Vivek Gautam gautam.vi...@samsung.com --- Documentation/devicetree/bindings/phy/samsung-phy.txt |9 + 1 file changed, 9 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt b/Documentation/devicetree/bindings/phy/samsung-phy.txt index d5bad92..0090ad1 100644 --- a/Documentation/devicetree/bindings/phy/samsung-phy.txt +++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt @@ -148,6 +148,9 @@ Required properties: control pmu registers for power isolation. - #phy-cells : from the generic PHY bindings, must be 1; +Optional properties: +- vbus-supply : Reference to regulator node which supplies VBUS on the PHY. + For samsung,exynos5250-usbdrd-phy and samsung,exynos5420-usbdrd-phy compatible PHYs, the second cell in the PHY specifier identifies the PHY id, which is interpreted as follows: @@ -164,6 +167,12 @@ Example: #phy-cells = 1; }; +Then the PHY can be used in other nodes such as: + phy-consumer@1234 { + phys = usbdrd_phy 0, usbdrd_phy 1; + phy-names = usb2-phy, usb3-phy; + }; + - aliases: For SoCs like Exynos5420 having multiple USB 3.0 DRD PHY controllers, 'usbdrd_phy' nodes should have numbered alias in the aliases node, in the form of usbdrdphyN, N = 0, 1... (depending on number of -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/4] phy: samsung-usb2: Add facility for VBUS supply
Adding support to enable/disable VBUS controlled by a regulator on USB 2.0 port. This is a part of moving vbus setting out of ehci-exynos. Since vbus can be handled by USB 2.0 phy itself, so the host need not care about it. Moreover, setting VBUS in USB 2.0 phy helps both ehci as well as ohci. This issue was not taken care of until now; when ehci is not enabled and only ohci is enabled the VBUS was never set. Keeping the vbus setting code in ehci-exynos intact for now to keep supporting older dt bindings. Signed-off-by: Vivek Gautam gautam.vi...@samsung.com --- .../devicetree/bindings/phy/samsung-phy.txt|3 ++ drivers/phy/phy-samsung-usb2.c | 30 drivers/phy/phy-samsung-usb2.h |1 + 3 files changed, 34 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt b/Documentation/devicetree/bindings/phy/samsung-phy.txt index 0090ad1..44d82ba 100644 --- a/Documentation/devicetree/bindings/phy/samsung-phy.txt +++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt @@ -44,6 +44,9 @@ Required properties: - the ref clock is used to get the rate of the clock provided to the PHY module +Optional properties: +- vbus-supply : Reference to regulator node which supplies VBUS on the PHY. + The first phandle argument in the PHY specifier identifies the PHY, its meaning is compatible dependent. For the currently supported SoCs (Exynos 4210 and Exynos 4212) it is as follows: diff --git a/drivers/phy/phy-samsung-usb2.c b/drivers/phy/phy-samsung-usb2.c index 4a12f66..7fe7c84 100644 --- a/drivers/phy/phy-samsung-usb2.c +++ b/drivers/phy/phy-samsung-usb2.c @@ -16,6 +16,7 @@ #include linux/of_address.h #include linux/phy/phy.h #include linux/platform_device.h +#include linux/regulator/consumer.h #include linux/spinlock.h #include phy-samsung-usb2.h @@ -33,6 +34,16 @@ static int samsung_usb2_phy_power_on(struct phy *phy) ret = clk_prepare_enable(drv-ref_clk); if (ret) goto err_instance_clk; + + /* Enable VBUS supply */ + if (drv-vbus) { + ret = regulator_enable(drv-vbus); + if (ret) { + dev_err(drv-dev, Failed to enable VBUS supply\n); + goto err_fail_vbus; + } + } + if (inst-cfg-power_on) { spin_lock(drv-lock); ret = inst-cfg-power_on(inst); @@ -41,6 +52,8 @@ static int samsung_usb2_phy_power_on(struct phy *phy) return 0; +err_fail_vbus: + clk_disable_unprepare(drv-ref_clk); err_instance_clk: clk_disable_unprepare(drv-clk); err_main_clk: @@ -60,8 +73,14 @@ static int samsung_usb2_phy_power_off(struct phy *phy) ret = inst-cfg-power_off(inst); spin_unlock(drv-lock); } + + /* Disable VBUS supply */ + if (drv-vbus) + regulator_disable(drv-vbus); + clk_disable_unprepare(drv-ref_clk); clk_disable_unprepare(drv-clk); + return ret; } @@ -197,6 +216,17 @@ static int samsung_usb2_phy_probe(struct platform_device *pdev) return ret; } + /* Get Vbus regulators */ + drv-vbus = devm_regulator_get(dev, vbus); + if (IS_ERR(drv-vbus)) { + ret = PTR_ERR(drv-vbus); + if (ret == -EPROBE_DEFER) + return ret; + + dev_warn(dev, Failed to get VBUS supply regulator\n); + drv-vbus = NULL; + } + for (i = 0; i drv-cfg-num_phys; i++) { char *label = drv-cfg-phys[i].label; struct samsung_usb2_phy_instance *p = drv-instances[i]; diff --git a/drivers/phy/phy-samsung-usb2.h b/drivers/phy/phy-samsung-usb2.h index 44bead9..cb92e3e 100644 --- a/drivers/phy/phy-samsung-usb2.h +++ b/drivers/phy/phy-samsung-usb2.h @@ -43,6 +43,7 @@ struct samsung_usb2_phy_driver { void __iomem *reg_phy; struct regmap *reg_pmu; struct regmap *reg_sys; + struct regulator *vbus; spinlock_t lock; struct samsung_usb2_phy_instance instances[0]; }; -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/4] arm: dts: exynos5250: Use regulator for USB 2.0 VBUS supply
Start using VBUS regulator for USB 2.0 phy, so that we can remove the gpio property from host's node later. Signed-off-by: Vivek Gautam gautam.vi...@samsung.com --- arch/arm/boot/dts/exynos5250-smdk5250.dts | 22 ++ arch/arm/boot/dts/exynos5250-snow.dts | 22 ++ 2 files changed, 44 insertions(+) diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts index a759100..85e74df 100644 --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts @@ -361,6 +361,17 @@ samsung,audio-codec = wm8994; }; + usb2_vbus_reg: regulator-usb2 { + compatible = regulator-fixed; + regulator-name = P5.0V_USB2; + regulator-min-microvolt = 500; + regulator-max-microvolt = 500; + gpio = gpx2 6 0; + pinctrl-names = default; + pinctrl-0 = usb2_vbus_en; + enable-active-high; + }; + usb@1211 { samsung,vbus-gpio = gpx2 6 0; }; @@ -418,4 +429,15 @@ samsung,pin-pud = 0; samsung,pin-drv = 0; }; + + usb2_vbus_en: usb2-vbus-en { + samsung,pins = gpx2-6; + samsung,pin-function = 1; + samsung,pin-pud = 0; + samsung,pin-drv = 0; + }; +}; + +usb2_phy_gen { + vbus-supply = usb2_vbus_reg; }; diff --git a/arch/arm/boot/dts/exynos5250-snow.dts b/arch/arm/boot/dts/exynos5250-snow.dts index 60429ad..8085750 100644 --- a/arch/arm/boot/dts/exynos5250-snow.dts +++ b/arch/arm/boot/dts/exynos5250-snow.dts @@ -285,6 +285,17 @@ vbus-supply = usb3_vbus_reg; }; + usb2_vbus_reg: regulator-usb2 { + compatible = regulator-fixed; + regulator-name = P5.0V_USB2; + regulator-min-microvolt = 500; + regulator-max-microvolt = 500; + gpio = gpx1 1 0; + pinctrl-names = default; + pinctrl-0 = usb2_vbus_en; + enable-active-high; + }; + usb@1211 { samsung,vbus-gpio = gpx1 1 0; }; @@ -616,6 +627,13 @@ samsung,pin-pud = 0; samsung,pin-drv = 0; }; + + usb2_vbus_en: usb2-vbus-en { + samsung,pins = gpx1-1; + samsung,pin-function = 1; + samsung,pin-pud = 0; + samsung,pin-drv = 0; + }; }; spi_1 { @@ -628,4 +646,8 @@ dr_mode = host; }; +usb2_phy_gen { + vbus-supply = usb2_vbus_reg; +}; + #include cros-ec-keyboard.dtsi -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/4] arm: dts: exynos5250: Remove vbus gpio property from usb 2.0 host
Now that we can use the VBUS regulator for USB 2.0 phy, we can remove the vbus-gpio property from usb 2.0 host to avoid duplicate gpio settings. Signed-off-by: Vivek Gautam gautam.vi...@samsung.com --- arch/arm/boot/dts/exynos5250-smdk5250.dts |4 arch/arm/boot/dts/exynos5250-snow.dts |4 2 files changed, 8 deletions(-) diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts index 85e74df..281b962 100644 --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts @@ -372,10 +372,6 @@ enable-active-high; }; - usb@1211 { - samsung,vbus-gpio = gpx2 6 0; - }; - dp-controller@145B { samsung,color-space = 0; samsung,dynamic-range = 0; diff --git a/arch/arm/boot/dts/exynos5250-snow.dts b/arch/arm/boot/dts/exynos5250-snow.dts index 8085750..ee966c3 100644 --- a/arch/arm/boot/dts/exynos5250-snow.dts +++ b/arch/arm/boot/dts/exynos5250-snow.dts @@ -296,10 +296,6 @@ enable-active-high; }; - usb@1211 { - samsung,vbus-gpio = gpx1 1 0; - }; - fixed-rate-clocks { xxti { compatible = samsung,clock-xxti; -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 0/4] phy: samsung-usb2: Add support for Vbus regulator
From: Vivek Gautam This has been on my to-do list for sometime. Until now the host controller (specifically ehci-exynos) is responsible for enabling VBUS supply. This opens up one more issue which is, when only ohci-exynos is enabled and ehci-exynosis disabled then VBUS was never enabled (since ohci did not have the code to enabled the VBUS supply). Rather it should be wise to move the VBUS related stuff to phy driver and let phy take care of enabling it. This patch series adds that VBUS regulator to phy-samsung-usb2 driver, adds necessary binding information as well as vbus-supply properties to phy nodes on exynos5250 systems. ... Does this go anyway to allowing devices to be powered from a micro-usb connector while acting as a USB host (USB OTG). ie when you want VBUS disabled even though it would normally need to be enabled. David -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/4] phy: samsung-usb2: Add support for Vbus regulator
On Thu, Dec 11, 2014 at 5:52 PM, David Laight david.lai...@aculab.com wrote: From: Vivek Gautam This has been on my to-do list for sometime. Until now the host controller (specifically ehci-exynos) is responsible for enabling VBUS supply. This opens up one more issue which is, when only ohci-exynos is enabled and ehci-exynosis disabled then VBUS was never enabled (since ohci did not have the code to enabled the VBUS supply). Rather it should be wise to move the VBUS related stuff to phy driver and let phy take care of enabling it. This patch series adds that VBUS regulator to phy-samsung-usb2 driver, adds necessary binding information as well as vbus-supply properties to phy nodes on exynos5250 systems. ... Does this go anyway to allowing devices to be powered from a micro-usb connector while acting as a USB host (USB OTG). ie when you want VBUS disabled even though it would normally need to be enabled. Sorry i didn't get your second line. This change allows HOST and HSIC phys to enable VBUS for the devices connected to it. Although now i think there can be a flaw in this approach when only in OTG mode, when DEVICE phy is being used, even then the regulator will be turned on causing power unnecessary consumption. -- Best Regards Vivek Gautam Samsung RD Institute, Bangalore India -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC 04/15] regulator: add restrack support
On Thu, Dec 11, 2014 at 12:58:37PM +, Mark Brown wrote: I'd expect someone reading the change in the regulator API to have at least some idea how this fits in with the rest of the API and how to use it, and probably more importantly I'd expect to be able to understand why this is DT only. Yep. This is a repetitive problem, and I fully agree with your concern about stuff which is supposed to be arch-independent being designed with only DT in mind. New core kernel features should *not* be designed with only DT in mind - DT is not the only firmware description language which the kernel supports. Folk need to understand that if they design a new arch independent kernel feature where the sole use case is with DT, that new feature is probably going to get rejected, especially when it's something as generic as resource tracking. The world is not DT only. -- FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up according to speedtest.net. -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 1/2] soc: samsung: add exynos chipid driver support
On Thu, Dec 11, 2014 at 2:07 AM, Pankaj Dubey pankaj.du...@samsung.com wrote: Exynos SoCs have Chipid, for identification of product IDs and SoC revisions. This patch intendes to provide initialization code for all these functionalites. This driver usese existing binding for exnos-chipid. s/usese/uses/ s/exnos/exynos/ CC: Grant Likely grant.lik...@linaro.org CC: Rob Herring robh...@kernel.org CC: Linus Walleij linus.wall...@linaro.org Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com --- drivers/soc/Kconfig| 1 + drivers/soc/Makefile | 1 + drivers/soc/samsung/Kconfig| 14 +++ drivers/soc/samsung/Makefile | 1 + drivers/soc/samsung/exynos-chipid.c| 168 + include/linux/soc/samsung/exynos-soc.h | 51 ++ 6 files changed, 236 insertions(+) create mode 100644 drivers/soc/samsung/Kconfig create mode 100644 drivers/soc/samsung/Makefile create mode 100644 drivers/soc/samsung/exynos-chipid.c create mode 100644 include/linux/soc/samsung/exynos-soc.h diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig index 76d6bd4..c3abfbe 100644 --- a/drivers/soc/Kconfig +++ b/drivers/soc/Kconfig @@ -1,6 +1,7 @@ menu SOC (System On Chip) specific Drivers source drivers/soc/qcom/Kconfig +source drivers/soc/samsung/Kconfig source drivers/soc/ti/Kconfig source drivers/soc/versatile/Kconfig diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile index 063113d..620366f 100644 --- a/drivers/soc/Makefile +++ b/drivers/soc/Makefile @@ -3,6 +3,7 @@ # obj-$(CONFIG_ARCH_QCOM)+= qcom/ +obj-$(CONFIG_SOC_SAMSUNG) += samsung/ obj-$(CONFIG_ARCH_TEGRA) += tegra/ obj-$(CONFIG_SOC_TI) += ti/ obj-$(CONFIG_PLAT_VERSATILE) += versatile/ diff --git a/drivers/soc/samsung/Kconfig b/drivers/soc/samsung/Kconfig new file mode 100644 index 000..2d83652 --- /dev/null +++ b/drivers/soc/samsung/Kconfig @@ -0,0 +1,14 @@ +# +# SAMSUNG SoC drivers +# +menu Samsung SOC driver support + +config SOC_SAMSUNG + bool + +config EXYNOS_CHIPID + bool + depends on ARCH_EXYNOS + select SOC_BUS This is going to show an empty menu when ARCH_EXYNOS is not enabled. The whole menu should probably have if ARCH_EXYNOS instead. + +endmenu diff --git a/drivers/soc/samsung/Makefile b/drivers/soc/samsung/Makefile new file mode 100644 index 000..855ca05 --- /dev/null +++ b/drivers/soc/samsung/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_EXYNOS_CHIPID)+= exynos-chipid.o diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c new file mode 100644 index 000..8968f83 --- /dev/null +++ b/drivers/soc/samsung/exynos-chipid.c @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * http://www.samsung.com/ + * + * EXYNOS - CHIP ID support + * Author: Pankaj Dubey pankaj.du...@samsung.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/io.h +#include linux/of.h +#include linux/of_address.h +#include linux/of_platform.h +#include linux/platform_device.h +#include linux/slab.h +#include linux/sys_soc.h +#include linux/soc/samsung/exynos-soc.h + +#define EXYNOS_SUBREV_MASK (0xF 4) +#define EXYNOS_MAINREV_MASK(0xF 0) +#define EXYNOS_REV_MASK(EXYNOS_SUBREV_MASK | EXYNOS_MAINREV_MASK) + +static void __iomem *exynos_chipid_base; + +struct exynos_chipid_info exynos_soc_info; +EXPORT_SYMBOL(exynos_soc_info); The soc_device already has similar data. Why is this needed? Is it temporary for compatibility? For early use? If for early use, then it should not be exported. + +static const char * __init product_id_to_name(unsigned int product_id) +{ + const char *soc_name; + unsigned int soc_id = product_id EXYNOS_SOC_MASK; + + switch (soc_id) { + case EXYNOS3250_SOC_ID: + soc_name = EXYNOS3250; + break; + case EXYNOS4210_SOC_ID: + soc_name = EXYNOS4210; + break; + case EXYNOS4212_SOC_ID: + soc_name = EXYNOS4212; + break; + case EXYNOS4412_SOC_ID: + soc_name = EXYNOS4412; + break; + case EXYNOS4415_SOC_ID: + soc_name = EXYNOS4415; + break; + case EXYNOS5250_SOC_ID: + soc_name = EXYNOS5250; + break; + case EXYNOS5260_SOC_ID: + soc_name = EXYNOS5260; + break; + case EXYNOS5420_SOC_ID: + soc_name = EXYNOS5420; + break; + case EXYNOS5440_SOC_ID: + soc_name = EXYNOS5440; + break; + case
[PATCH/RFC 00/14] ASoC: samsung: Add clk provider for I2S internal clocks
This series is an attempt to resolve the CDCLK clock gating issue on Odroid X2/U3 reported by Daniel Drake [1], by exposing the CDCLK gate clock through clk API. The remaining clocks (mux and divider) are also exposed, so the clk API could be already used instead of the set_sysclk() calls in the machine drivers. I need some more thought about interaction between the clk API calls on the clocks being exposed and the ASoC calls into sound/soc/samsung/i2s.c. I'm sending teh patches for review though to avoid any waste of time should it turn out the direction taken is wrong. This whole series definitely needs more testing, so far I only tested it on Odroid X2, with the I2S working in slave mode. [1] http://mailman.alsa-project.org/pipermail/alsa-devel/2014-September/081753.html Sylwester Nawrocki (14): ASoC: samsung: i2s: Remove unused gpios field from struct i2s ASoC: samsung: i2s: samsung_i2s_get_driver_data() cleanup ASoC: samsung: i2s: Add return value checks in probe() ASoC: samsung: i2s: Request memory region in driver probe() ASoC: samsung: i2s: Move clk_get() to platform driver probe() ASoC: samsung: i2s: Move clk enable to the platform driver probe() ASoC: samsung: i2s: Add get_other_dai helper function ASoC: samsung: i2s: Remove an unneeded goto usage ASoC: samsung: i2s: Add spinlock in place of local_irq_* calls ASoC: samsung: i2s: Protect access to more registers with a spinlock ASoC: samsung: odroidx2: Handle I2S CDCLK clock conditionally ASoC: samsung: i2s: Add clock provider for the I2S internal clocks ARM: dts: Exynos4 and Odroid X2/U3 sound device nodes update ARM: dts: Switch Odroid X2/U2 to simple-audio-card .../devicetree/bindings/sound/samsung-i2s.txt | 18 +- arch/arm/boot/dts/exynos4.dtsi |9 + arch/arm/boot/dts/exynos4412-odroid-common.dtsi| 26 +- arch/arm/boot/dts/exynos4412-odroidu3.dts |8 +- arch/arm/boot/dts/exynos4412-odroidx2.dts |8 +- sound/soc/samsung/i2s.c| 365 sound/soc/samsung/odroidx2_max98090.c |6 +- 7 files changed, 282 insertions(+), 158 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC 09/14] ASoC: samsung: i2s: Add spinlock in place of local_irq_* calls
It seems this driver hasn't been updated for SMP, as local_irq_save/ local_irq_restore doesn't provide proper protection of read/modify/write of the device's registers on such systems. Introduce a spinlock serializing access to the register region, it will be helpful later when some of the registers are made also accessible through the clk API. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com --- sound/soc/samsung/i2s.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index a131621..e8e0107 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -94,6 +94,10 @@ struct i2s_dai { u32 suspend_i2scon; u32 suspend_i2spsr; const struct samsung_i2s_variant_regs *variant_regs; + + /* Spinlock protecting access to the device's registers */ + spinlock_t spinlock; + spinlock_t *lock; }; /* Lock for cross i/f checks */ @@ -867,10 +871,10 @@ static int i2s_trigger(struct snd_pcm_substream *substream, case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: - local_irq_save(flags); + spin_lock_irqsave(i2s-lock, flags); if (config_setup(i2s)) { - local_irq_restore(flags); + spin_unlock_irqrestore(i2s-lock, flags); return -EINVAL; } @@ -879,12 +883,12 @@ static int i2s_trigger(struct snd_pcm_substream *substream, else i2s_txctrl(i2s, 1); - local_irq_restore(flags); + spin_unlock_irqrestore(i2s-lock, flags); break; case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - local_irq_save(flags); + spin_lock_irqsave(i2s-lock, flags); if (capture) { i2s_rxctrl(i2s, 0); @@ -894,7 +898,7 @@ static int i2s_trigger(struct snd_pcm_substream *substream, i2s_fifo(i2s, FIC_TXFLUSH); } - local_irq_restore(flags); + spin_unlock_irqrestore(i2s-lock, flags); break; } @@ -1157,6 +1161,9 @@ static int samsung_i2s_probe(struct platform_device *pdev) return -ENOMEM; } + spin_lock_init(pri_dai-spinlock); + pri_dai-lock = pri_dai-spinlock; + if (!np) { res = platform_get_resource(pdev, IORESOURCE_DMA, 0); if (!res) { @@ -1234,6 +1241,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) return -ENOMEM; } + sec_dai-lock = pri_dai-spinlock; sec_dai-variant_regs = pri_dai-variant_regs; sec_dai-dma_playback.dma_addr = regs_base + I2STXDS; sec_dai-dma_playback.ch_name = tx-sec; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC 08/14] ASoC: samsung: i2s: Remove an unneeded goto usage
The usage of this goto seems unjustified, use if/else statement instead. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com --- sound/soc/samsung/i2s.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 6501c40..a131621 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -979,19 +979,18 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) if (is_secondary(i2s)) { /* If this is probe on the secondary DAI */ samsung_asoc_init_dma_data(dai, other-sec_dai-dma_playback, NULL); - goto probe_exit; - } - - samsung_asoc_init_dma_data(dai, i2s-dma_playback, i2s-dma_capture); + } else { + samsung_asoc_init_dma_data(dai, i2s-dma_playback, + i2s-dma_capture); - if (i2s-quirks QUIRK_NEED_RSTCLR) - writel(CON_RSTCLR, i2s-addr + I2SCON); + if (i2s-quirks QUIRK_NEED_RSTCLR) + writel(CON_RSTCLR, i2s-addr + I2SCON); - if (i2s-quirks QUIRK_SUPPORTS_IDMA) - idma_reg_addr_init(i2s-addr, + if (i2s-quirks QUIRK_SUPPORTS_IDMA) + idma_reg_addr_init(i2s-addr, i2s-sec_dai-idma_playback.dma_addr); + } -probe_exit: /* Reset any constraint on RFS and BFS */ i2s-rfs = 0; i2s-bfs = 0; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC 07/14] ASoC: samsung: i2s: Add get_other_dai helper function
The code to get pointer to the other DAI is repeated multiple times. Add a helper function and use it to simplify the code a little. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com --- sound/soc/samsung/i2s.c | 24 +++- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 871925b..6501c40 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -130,10 +130,16 @@ static inline bool tx_active(struct i2s_dai *i2s) return active ? true : false; } +/* Return pointer to the other DAI */ +static inline struct i2s_dai *get_other_dai(struct i2s_dai *i2s) +{ + return i2s-pri_dai ? : i2s-sec_dai; +} + /* If the other interface of the controller is transmitting data */ static inline bool other_tx_active(struct i2s_dai *i2s) { - struct i2s_dai *other = i2s-pri_dai ? : i2s-sec_dai; + struct i2s_dai *other = get_other_dai(i2s); return tx_active(other); } @@ -160,7 +166,7 @@ static inline bool rx_active(struct i2s_dai *i2s) /* If the other interface of the controller is receiving data */ static inline bool other_rx_active(struct i2s_dai *i2s) { - struct i2s_dai *other = i2s-pri_dai ? : i2s-sec_dai; + struct i2s_dai *other = get_other_dai(i2s); return rx_active(other); } @@ -461,7 +467,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int rfs, int dir) { struct i2s_dai *i2s = to_info(dai); - struct i2s_dai *other = i2s-pri_dai ? : i2s-sec_dai; + struct i2s_dai *other = get_other_dai(i2s); u32 mod = readl(i2s-addr + I2SMOD); const struct samsung_i2s_variant_regs *i2s_regs = i2s-variant_regs; unsigned int cdcon_mask = 1 i2s_regs-cdclkcon_off; @@ -733,7 +739,7 @@ static int i2s_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct i2s_dai *i2s = to_info(dai); - struct i2s_dai *other = i2s-pri_dai ? : i2s-sec_dai; + struct i2s_dai *other = get_other_dai(i2s); unsigned long flags; spin_lock_irqsave(lock, flags); @@ -760,7 +766,7 @@ static void i2s_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct i2s_dai *i2s = to_info(dai); - struct i2s_dai *other = i2s-pri_dai ? : i2s-sec_dai; + struct i2s_dai *other = get_other_dai(i2s); unsigned long flags; const struct samsung_i2s_variant_regs *i2s_regs = i2s-variant_regs; @@ -791,7 +797,7 @@ static void i2s_shutdown(struct snd_pcm_substream *substream, static int config_setup(struct i2s_dai *i2s) { - struct i2s_dai *other = i2s-pri_dai ? : i2s-sec_dai; + struct i2s_dai *other = get_other_dai(i2s); unsigned rfs, bfs, blc; u32 psr; @@ -899,7 +905,7 @@ static int i2s_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div) { struct i2s_dai *i2s = to_info(dai); - struct i2s_dai *other = i2s-pri_dai ? : i2s-sec_dai; + struct i2s_dai *other = get_other_dai(i2s); switch (div_id) { case SAMSUNG_I2S_DIV_BCLK: @@ -968,7 +974,7 @@ static int i2s_resume(struct snd_soc_dai *dai) static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) { struct i2s_dai *i2s = to_info(dai); - struct i2s_dai *other = i2s-pri_dai ? : i2s-sec_dai; + struct i2s_dai *other = get_other_dai(i2s); if (is_secondary(i2s)) { /* If this is probe on the secondary DAI */ samsung_asoc_init_dma_data(dai, other-sec_dai-dma_playback, @@ -1271,7 +1277,7 @@ static int samsung_i2s_remove(struct platform_device *pdev) struct i2s_dai *i2s, *other; i2s = dev_get_drvdata(pdev-dev); - other = i2s-pri_dai ? : i2s-sec_dai; + other = get_other_dai(i2s); if (other) { other-pri_dai = NULL; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC 01/14] ASoC: samsung: i2s: Remove unused gpios field from struct i2s
The 'gpios' field in 'struct i2s' is now unused, this change seems to be missing in commit 0429ffeff460c4302bd1520e6 (ASoC: samsung: Remove obsolete GPIO based DT pinmuxing). Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com --- sound/soc/samsung/i2s.c |1 - 1 file changed, 1 deletion(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index c1f70fe..2c07592 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -95,7 +95,6 @@ struct i2s_dai { u32 suspend_i2smod; u32 suspend_i2scon; u32 suspend_i2spsr; - unsigned long gpios[7]; /* i2s gpio line numbers */ const struct samsung_i2s_variant_regs *variant_regs; }; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC 05/14] ASoC: samsung: i2s: Move clk_get() to platform driver probe()
Acquire the I2S interface clock in driver probe() callback as it's a per-device not a per-DAI clock. While at it switch to the resource managed clk_get(). Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com --- sound/soc/samsung/i2s.c | 19 +++ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 5d8aebd..56fe01d 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -971,18 +971,12 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) struct i2s_dai *other = i2s-pri_dai ? : i2s-sec_dai; int ret; - if (other other-clk) { /* If this is probe on secondary */ + if (is_secondary(i2s)) { /* If this is probe on the secondary DAI */ samsung_asoc_init_dma_data(dai, other-sec_dai-dma_playback, NULL); goto probe_exit; } - i2s-clk = clk_get(i2s-pdev-dev, iis); - if (IS_ERR(i2s-clk)) { - dev_err(i2s-pdev-dev, failed to get i2s_clock\n); - return PTR_ERR(i2s-clk); - } - ret = clk_prepare_enable(i2s-clk); if (ret != 0) { dev_err(i2s-pdev-dev, failed to enable clock: %d\n, ret); @@ -991,10 +985,6 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) samsung_asoc_init_dma_data(dai, i2s-dma_playback, i2s-dma_capture); - if (other) { - other-clk = i2s-clk; - } - if (i2s-quirks QUIRK_NEED_RSTCLR) writel(CON_RSTCLR, i2s-addr + I2SCON); @@ -1032,7 +1022,6 @@ static int samsung_i2s_dai_remove(struct snd_soc_dai *dai) writel(0, i2s-addr + I2SCON); clk_disable_unprepare(i2s-clk); - clk_put(i2s-clk); } i2s-clk = NULL; @@ -1222,6 +1211,11 @@ static int samsung_i2s_probe(struct platform_device *pdev) regs_base = res-start; + pri_dai-clk = devm_clk_get(pdev-dev, iis); + if (IS_ERR(pri_dai-clk)) { + dev_err(pdev-dev, Failed to get iis clock\n); + return PTR_ERR(pri_dai-clk); + } pri_dai-dma_playback.dma_addr = regs_base + I2STXD; pri_dai-dma_capture.dma_addr = regs_base + I2SRXD; pri_dai-dma_playback.ch_name = tx; @@ -1253,6 +1247,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) sec_dai-dma_playback.dma_size = 4; sec_dai-addr = pri_dai-addr; + sec_dai-clk = pri_dai-clk; sec_dai-quirks = quirks; sec_dai-idma_playback.dma_addr = idma_addr; sec_dai-pri_dai = pri_dai; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC 10/14] ASoC: samsung: i2s: Protect access to more registers with a spinlock
It seems this driver hasn't been updated for SMP, as local_irq_save/ local_irq_restore doesn't provide proper protection of read/modify/ write of the device's registers on such systems. Introduce a spinlock serializing access to the registers, it will be helpful later when I2SMOD, I2SPSR registers are made also accessible through the clk API. Possibly some changes within this patch are not required, I'm not confident what exactly needs to be serialized in the driver and what is already taken care for in the ASoC core. At least I tried to cover the I2SMOD, I2SPSR registers. Since the I2S register region is common for 2 DAIs I suspect the serialization here might need again a careful review. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com --- sound/soc/samsung/i2s.c | 81 +-- 1 file changed, 51 insertions(+), 30 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index e8e0107..825138b 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -472,17 +472,22 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, { struct i2s_dai *i2s = to_info(dai); struct i2s_dai *other = get_other_dai(i2s); - u32 mod = readl(i2s-addr + I2SMOD); const struct samsung_i2s_variant_regs *i2s_regs = i2s-variant_regs; unsigned int cdcon_mask = 1 i2s_regs-cdclkcon_off; unsigned int rsrc_mask = 1 i2s_regs-rclksrc_off; + u32 mod, mask, val = 0; + + spin_lock(i2s-lock); + mod = readl(i2s-addr + I2SMOD); + spin_unlock(i2s-lock); switch (clk_id) { case SAMSUNG_I2S_OPCLK: - mod = ~MOD_OPCLK_MASK; - mod |= dir; + mask = MOD_OPCLK_MASK; + val = dir; break; case SAMSUNG_I2S_CDCLK: + mask = 1 i2s_regs-cdclkcon_off; /* Shouldn't matter in GATING(CLOCK_IN) mode */ if (dir == SND_SOC_CLOCK_IN) rfs = 0; @@ -499,15 +504,15 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, } if (dir == SND_SOC_CLOCK_IN) - mod |= 1 i2s_regs-cdclkcon_off; - else - mod = ~(1 i2s_regs-cdclkcon_off); + val = 1 i2s_regs-cdclkcon_off; i2s-rfs = rfs; break; case SAMSUNG_I2S_RCLKSRC_0: /* clock corrsponding to IISMOD[10] := 0 */ case SAMSUNG_I2S_RCLKSRC_1: /* clock corrsponding to IISMOD[10] := 1 */ + mask = 1 i2s_regs-rclksrc_off; + if ((i2s-quirks QUIRK_NO_MUXPSR) || (clk_id == SAMSUNG_I2S_RCLKSRC_0)) clk_id = 0; @@ -557,18 +562,19 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, return 0; } - if (clk_id == 0) - mod = ~(1 i2s_regs-rclksrc_off); - else - mod |= 1 i2s_regs-rclksrc_off; - + if (clk_id == 1) + val = 1 i2s_regs-rclksrc_off; break; default: dev_err(i2s-pdev-dev, We don't serve that!\n); return -EINVAL; } + spin_lock(i2s-lock); + mod = readl(i2s-addr + I2SMOD); + mod = (mod ~mask) | val; writel(mod, i2s-addr + I2SMOD); + spin_unlock(i2s-lock); return 0; } @@ -577,9 +583,8 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) { struct i2s_dai *i2s = to_info(dai); - u32 mod = readl(i2s-addr + I2SMOD); int lrp_shift, sdf_shift, sdf_mask, lrp_rlow, mod_slave; - u32 tmp = 0; + u32 mod, tmp = 0; lrp_shift = i2s-variant_regs-lrp_off; sdf_shift = i2s-variant_regs-sdf_off; @@ -639,12 +644,15 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, return -EINVAL; } + spin_lock(i2s-lock); + mod = readl(i2s-addr + I2SMOD); /* * Don't change the I2S mode if any controller is active on this * channel. */ if (any_active(i2s) ((mod (sdf_mask | lrp_rlow | mod_slave)) != tmp)) { + spin_unlock(i2s-lock); dev_err(i2s-pdev-dev, %s:%d Other DAI busy\n, __func__, __LINE__); return -EAGAIN; @@ -653,6 +661,7 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, mod = ~(sdf_mask | lrp_rlow | mod_slave); mod |= tmp; writel(mod, i2s-addr + I2SMOD); + spin_unlock(i2s-lock); return 0; } @@ -661,16 +670,16 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { struct i2s_dai *i2s = to_info(dai); - u32 mod = readl(i2s-addr + I2SMOD); + u32 mod, mask = 0, val = 0;
[PATCH/RFC 02/14] ASoC: samsung: i2s: samsung_i2s_get_driver_data() cleanup
Tidy up the samsung_i2s_get_driver_data() function by using IS_ENABLE() instead of #ifdef and add missing braces for the 'else' part. Also ensure we are not dereferencing NULL 'match' pointer. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com --- sound/soc/samsung/i2s.c |9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 2c07592..45f7f0f 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1123,15 +1123,14 @@ static const struct of_device_id exynos_i2s_match[]; static inline const struct samsung_i2s_dai_data *samsung_i2s_get_driver_data( struct platform_device *pdev) { -#ifdef CONFIG_OF - if (pdev-dev.of_node) { + if (IS_ENABLED(CONFIG_OF) pdev-dev.of_node) { const struct of_device_id *match; match = of_match_node(exynos_i2s_match, pdev-dev.of_node); - return match-data; - } else -#endif + return match ? match-data : NULL; + } else { return (struct samsung_i2s_dai_data *) platform_get_device_id(pdev)-driver_data; + } } #ifdef CONFIG_PM_RUNTIME -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC 11/14] ASoC: samsung: odroidx2: Handle I2S CDCLK clock conditionally
If the codec control it's master clock provider by the I2S module we should not be touching it with set_sysclk() calls. So skip the set_sysclk() call in the machine driver if clocks property is found in the codec device node. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com --- sound/soc/samsung/odroidx2_max98090.c |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sound/soc/samsung/odroidx2_max98090.c b/sound/soc/samsung/odroidx2_max98090.c index 3c8f604..ca94938 100644 --- a/sound/soc/samsung/odroidx2_max98090.c +++ b/sound/soc/samsung/odroidx2_max98090.c @@ -21,6 +21,8 @@ struct odroidx2_drv_data { /* The I2S CDCLK output clock frequency for the MAX98090 codec */ #define MAX98090_MCLK 1920 +static struct snd_soc_dai_link odroidx2_dai[]; + static int odroidx2_late_probe(struct snd_soc_card *card) { struct snd_soc_dai *codec_dai = card-rtd[0].codec_dai; @@ -29,7 +31,9 @@ static int odroidx2_late_probe(struct snd_soc_card *card) ret = snd_soc_dai_set_sysclk(codec_dai, 0, MAX98090_MCLK, SND_SOC_CLOCK_IN); - if (ret 0) + + if (ret 0 || of_find_property(odroidx2_dai[0].codec_of_node, + clocks, NULL)) return ret; /* Set the cpu DAI configuration in order to use CDCLK */ -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC 04/14] ASoC: samsung: i2s: Request memory region in driver probe()
The memory mapped registers region is common for both DAIs so request it in the I2S platform device driver's probe for the platform device corresponding to the primary DAI, rather than in the ASoC DAI's probe callback. While at it switch to devm_ioremap_resource(). This also drops the hard coded (0x100) register region size in the driver. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com --- sound/soc/samsung/i2s.c | 45 +++-- 1 file changed, 7 insertions(+), 38 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index d65e092..5d8aebd 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -59,10 +59,8 @@ struct samsung_i2s_dai_data { struct i2s_dai { /* Platform device for this DAI */ struct platform_device *pdev; - /* IOREMAP'd SFRs */ + /* Memory mapped SFR region */ void __iomem*addr; - /* Physical base address of SFRs */ - u32 base; /* Rate of RCLK source clock */ unsigned long rclk_srcrate; /* Frame Clock */ @@ -979,16 +977,9 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) goto probe_exit; } - i2s-addr = ioremap(i2s-base, 0x100); - if (i2s-addr == NULL) { - dev_err(i2s-pdev-dev, cannot ioremap registers\n); - return -ENXIO; - } - i2s-clk = clk_get(i2s-pdev-dev, iis); if (IS_ERR(i2s-clk)) { dev_err(i2s-pdev-dev, failed to get i2s_clock\n); - iounmap(i2s-addr); return PTR_ERR(i2s-clk); } @@ -1001,7 +992,6 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) samsung_asoc_init_dma_data(dai, i2s-dma_playback, i2s-dma_capture); if (other) { - other-addr = i2s-addr; other-clk = i2s-clk; } @@ -1043,8 +1033,6 @@ static int samsung_i2s_dai_remove(struct snd_soc_dai *dai) clk_disable_unprepare(i2s-clk); clk_put(i2s-clk); - - iounmap(i2s-addr); } i2s-clk = NULL; @@ -1162,7 +1150,6 @@ static int samsung_i2s_probe(struct platform_device *pdev) u32 regs_base, quirks = 0, idma_addr = 0; struct device_node *np = pdev-dev.of_node; const struct samsung_i2s_dai_data *i2s_dai_data; - int ret = 0; /* Call during Seconday interface registration */ i2s_dai_data = samsung_i2s_get_driver_data(pdev); @@ -1229,16 +1216,10 @@ static int samsung_i2s_probe(struct platform_device *pdev) } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, Unable to get I2S SFR address\n); - return -ENXIO; - } + pri_dai-addr = devm_ioremap_resource(pdev-dev, res); + if (IS_ERR(pri_dai-addr)) + return PTR_ERR(pri_dai-addr); - if (!request_mem_region(res-start, resource_size(res), - samsung-i2s)) { - dev_err(pdev-dev, Unable to request SFR region\n); - return -EBUSY; - } regs_base = res-start; pri_dai-dma_playback.dma_addr = regs_base + I2STXD; @@ -1247,7 +1228,6 @@ static int samsung_i2s_probe(struct platform_device *pdev) pri_dai-dma_capture.ch_name = rx; pri_dai-dma_playback.dma_size = 4; pri_dai-dma_capture.dma_size = 4; - pri_dai-base = regs_base; pri_dai-quirks = quirks; pri_dai-variant_regs = i2s_dai_data-i2s_variant_regs; @@ -1258,8 +1238,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) sec_dai = i2s_alloc_dai(pdev, true); if (!sec_dai) { dev_err(pdev-dev, Unable to alloc I2S_sec\n); - ret = -ENOMEM; - goto err; + return -ENOMEM; } sec_dai-variant_regs = pri_dai-variant_regs; @@ -1273,7 +1252,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) } sec_dai-dma_playback.dma_size = 4; - sec_dai-base = regs_base; + sec_dai-addr = pri_dai-addr; sec_dai-quirks = quirks; sec_dai-idma_playback.dma_addr = idma_addr; sec_dai-pri_dai = pri_dai; @@ -1282,8 +1261,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) if (i2s_pdata i2s_pdata-cfg_gpio i2s_pdata-cfg_gpio(pdev)) { dev_err(pdev-dev, Unable to configure gpio\n); - ret = -EINVAL; - goto err; + return -EINVAL; } devm_snd_soc_register_component(pri_dai-pdev-dev, @@ -1297,17 +1275,11 @@ static int samsung_i2s_probe(struct platform_device *pdev) return ret; return 0; -err: - if (res) -
[PATCH/RFC 03/14] ASoC: samsung: i2s: Add return value checks in probe()
Those function may fail so let's report properly any errors. Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com --- sound/soc/samsung/i2s.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 45f7f0f..d65e092 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1173,11 +1173,13 @@ static int samsung_i2s_probe(struct platform_device *pdev) dev_err(pdev-dev, Unable to get drvdata\n); return -EFAULT; } - devm_snd_soc_register_component(sec_dai-pdev-dev, + ret = devm_snd_soc_register_component(sec_dai-pdev-dev, samsung_i2s_component, sec_dai-i2s_dai_drv, 1); - samsung_asoc_dma_platform_register(pdev-dev); - return 0; + if (ret != 0) + return ret; + + return samsung_asoc_dma_platform_register(pdev-dev); } pri_dai = i2s_alloc_dai(pdev, false); @@ -1290,7 +1292,9 @@ static int samsung_i2s_probe(struct platform_device *pdev) pm_runtime_enable(pdev-dev); - samsung_asoc_dma_platform_register(pdev-dev); + ret = samsung_asoc_dma_platform_register(pdev-dev); + if (ret != 0) + return ret; return 0; err: -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC 12/14] ASoC: samsung: i2s: Add clock provider for the I2S internal clocks
This patch adds clock provider (currently only for DT platforms) for the CODECLKO (CDCLK) gate, RCLKSRC mux and RCLK pre-scaler divider divider clock. Those all tree clock are only available in the IIS Multi Audio Interface (I2S0), the regular IIS Bus Interface has only CDCLK gate clock. The motivation behind this patch is to expose the I2S internal clocks which are currently controlled through set_sysclk() through the clk API, so dedicated sound machine driver per each board can be avoided. The intention is also to fix the CDCLK gating issue reported by Daniel Drake: http://mailman.alsa-project.org/pipermail/alsa-devel/2014-September/081753.html This patch also reverts commit b97c60abf9a561f86ae71bd741add02673cc1 (ASoC: samsung-i2s: Maintain CDCLK settings across i2s_{shutdown/ startup}) The problem that commit attempted to solve only affects the Odroid X2/U3, which doesn't configure the CDCLK clock in struct snd_soc_dai_ops hw_params callback and the issue should be now resolved by using clk API, i.e. having the codec enabling/ disabling the CDCLK clock as required. Cc: devicet...@vger.kernel.org Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com --- .../devicetree/bindings/sound/samsung-i2s.txt | 18 ++- sound/soc/samsung/i2s.c| 116 2 files changed, 113 insertions(+), 21 deletions(-) diff --git a/Documentation/devicetree/bindings/sound/samsung-i2s.txt b/Documentation/devicetree/bindings/sound/samsung-i2s.txt index d188296..fb3b777 100644 --- a/Documentation/devicetree/bindings/sound/samsung-i2s.txt +++ b/Documentation/devicetree/bindings/sound/samsung-i2s.txt @@ -34,12 +34,26 @@ Required SoC Specific Properties: clk. i2s0 has internal mux to select the source of root clk and i2s1 and i2s2 doesn't have any such mux. -Optional SoC Specific Properties: +Optional Properties: - samsung,idma-addr: Internal DMA register base address of the audio sub system(used in secondary sound source). - pinctrl-0: Should specify pin control groups used for this controller. - pinctrl-names: Should contain only one value - default. +- #clock-cells: should be 1, this property must be present if the I2S device + is a clock provider in terms of the common clock bindings, described in + ../clock/clock-bindings.txt. +- clock-output-names: from the common clock bindings, names of the CDCLK + I2S output clocks, suggested values are i2s_cdclk0, i2s_cdclk1, + i2s_cdclk3 for the I2S0, I2S1, I2S2 devices recpectively. + +The assignment of indices for the I2Sx clock provider is as follows: + 0 - the CDCLK (CODECLKO) gate clock, + 1 - the RCLK prescaler divider clock (corresponding to the IISPSR register), + 2 - the RCLKSRC mux clock (corresponding to RCLKSRC bit in register IISMOD). + +Clocks 1, 2 are normally only available in the IIS Mutli Audio Interface (I2S0). + Example: @@ -54,6 +68,8 @@ i2s0: i2s@0383 { clock_audss EXYNOS_I2S_BUS, clock_audss EXYNOS_SCLK_I2S; clock-names = iis, i2s_opclk0, i2s_opclk1; + #clock-cells; + clock-output-names = i2s_cdclk0; samsung,idma-addr = 0x0300; pinctrl-names = default; pinctrl-0 = i2s0_bus; diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 825138b..3f4d2c0 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -13,6 +13,7 @@ #include linux/delay.h #include linux/slab.h #include linux/clk.h +#include linux/clk-provider.h #include linux/io.h #include linux/module.h #include linux/of.h @@ -81,8 +82,6 @@ struct i2s_dai { #define DAI_OPENED (1 0) /* Dai is opened */ #define DAI_MANAGER(1 1) /* Dai is the manager */ unsigned mode; - /* CDCLK pin direction: 0 - input, 1 - output */ - unsigned int cdclk_out:1; /* Driver for this DAI */ struct snd_soc_dai_driver i2s_dai_drv; /* DMA parameters */ @@ -98,6 +97,10 @@ struct i2s_dai { /* Spinlock protecting access to the device's registers */ spinlock_t spinlock; spinlock_t *lock; + + /* Below fields are only valid if this is the primary FIFO */ + struct clk *clk_table[3]; + struct clk_onecell_data clk_data; }; /* Lock for cross i/f checks */ @@ -774,9 +777,6 @@ static int i2s_startup(struct snd_pcm_substream *substream, spin_unlock_irqrestore(lock, flags); - if (!is_opened(other) i2s-cdclk_out) - i2s_set_sysclk(dai, SAMSUNG_I2S_CDCLK, - 0, SND_SOC_CLOCK_OUT); return 0; } @@ -786,31 +786,20 @@ static void i2s_shutdown(struct snd_pcm_substream *substream, struct i2s_dai *i2s = to_info(dai); struct i2s_dai *other = get_other_dai(i2s); unsigned long flags; - const struct samsung_i2s_variant_regs *i2s_regs = i2s-variant_regs; spin_lock_irqsave(lock, flags); i2s-mode = ~DAI_OPENED; i2s-mode = ~DAI_MANAGER; - if
[PATCH/RFC 06/14] ASoC: samsung: i2s: Move clk enable to the platform driver probe()
Gating the I2S bus clock in the driver's runtime PM callbacks has currently really no effect since the clock is being enabled in the DAI's probe() and thus is permanently turned on. Now we just move the enable to the platform driver's probe(), which doesn't change the situation much. It will allow us to register later on a clock provider already in samsung_i2s_probe(). Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com --- sound/soc/samsung/i2s.c | 25 +++-- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 56fe01d..871925b 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -969,7 +969,6 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) { struct i2s_dai *i2s = to_info(dai); struct i2s_dai *other = i2s-pri_dai ? : i2s-sec_dai; - int ret; if (is_secondary(i2s)) { /* If this is probe on the secondary DAI */ samsung_asoc_init_dma_data(dai, other-sec_dai-dma_playback, @@ -977,12 +976,6 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) goto probe_exit; } - ret = clk_prepare_enable(i2s-clk); - if (ret != 0) { - dev_err(i2s-pdev-dev, failed to enable clock: %d\n, ret); - return ret; - } - samsung_asoc_init_dma_data(dai, i2s-dma_playback, i2s-dma_capture); if (i2s-quirks QUIRK_NEED_RSTCLR) @@ -1014,18 +1007,12 @@ probe_exit: static int samsung_i2s_dai_remove(struct snd_soc_dai *dai) { struct i2s_dai *i2s = snd_soc_dai_get_drvdata(dai); - struct i2s_dai *other = i2s-pri_dai ? : i2s-sec_dai; - - if (!other || !other-clk) { + if (!is_secondary(i2s)) { if (i2s-quirks QUIRK_NEED_RSTCLR) writel(0, i2s-addr + I2SCON); - - clk_disable_unprepare(i2s-clk); } - i2s-clk = NULL; - return 0; } @@ -1139,6 +1126,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) u32 regs_base, quirks = 0, idma_addr = 0; struct device_node *np = pdev-dev.of_node; const struct samsung_i2s_dai_data *i2s_dai_data; + int ret; /* Call during Seconday interface registration */ i2s_dai_data = samsung_i2s_get_driver_data(pdev); @@ -1216,6 +1204,12 @@ static int samsung_i2s_probe(struct platform_device *pdev) dev_err(pdev-dev, Failed to get iis clock\n); return PTR_ERR(pri_dai-clk); } + + ret = clk_prepare_enable(pri_dai-clk); + if (ret != 0) { + dev_err(pdev-dev, failed to enable clock: %d\n, ret); + return ret; + } pri_dai-dma_playback.dma_addr = regs_base + I2STXD; pri_dai-dma_capture.dma_addr = regs_base + I2SRXD; pri_dai-dma_playback.ch_name = tx; @@ -1286,6 +1280,9 @@ static int samsung_i2s_remove(struct platform_device *pdev) pm_runtime_disable(pdev-dev); } + if (!is_secondary(i2s)) + clk_disable_unprepare(i2s-clk); + i2s-pri_dai = NULL; i2s-sec_dai = NULL; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC 14/14] ARM: dts: Switch Odroid X2/U2 to simple-audio-card
Now when the CDCLK I2S output clock can be handled through the clock API the Odroid X2/U3 can be switched to the simple-audio-card DT binding. Cc: devicet...@vger.kernel.org Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com --- arch/arm/boot/dts/exynos4.dtsi |3 +++ arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 19 --- arch/arm/boot/dts/exynos4412-odroidu3.dts |8 +--- arch/arm/boot/dts/exynos4412-odroidx2.dts |8 ++-- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi index e1ce457..5f9e72f 100644 --- a/arch/arm/boot/dts/exynos4.dtsi +++ b/arch/arm/boot/dts/exynos4.dtsi @@ -66,6 +66,7 @@ dmas = pdma0 12, pdma0 11, pdma0 10; dma-names = tx, rx, tx-sec; samsung,idma-addr = 0x0300; + #sound-dai-cells = 1; status = disabled; }; @@ -378,6 +379,7 @@ clock-output-names = i2s_cdclk1; dmas = pdma1 12, pdma1 11; dma-names = tx, rx; + #sound-dai-cells = 1; status = disabled; }; @@ -390,6 +392,7 @@ clock-output-names = i2s_cdclk2; dmas = pdma0 14, pdma0 13; dma-names = tx, rx; + #sound-dai-cells = 1; status = disabled; }; diff --git a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi index 956737e..89fed7a 100644 --- a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi +++ b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi @@ -43,9 +43,7 @@ }; sound: sound { - compatible = samsung,odroidx2-audio; - samsung,i2s-controller = i2s0; - samsung,audio-codec = max98090; + compatible = simple-audio-card; assigned-clocks = clock_audss EXYNOS_MOUT_AUDSS, clock_audss EXYNOS_MOUT_I2S, clock_audss EXYNOS_DOUT_SRP, @@ -56,6 +54,20 @@ 0, 19200, 1920; + + simple-audio-card,format = i2s; + simple-audio-card,bitclock-master = link0_codec; + simple-audio-card,frame-master = link0_codec; + + simple-audio-card,cpu { + sound-dai = i2s0 0; + system-clock-frequency = 1920; + }; + + link0_codec: simple-audio-card,codec { + sound-dai = max98090; + clocks = i2s0 0; + }; }; mmc@1255 { @@ -360,6 +372,7 @@ interrupts = 0 0; clocks = i2s0 0; clock-names = mclk; + #sound-dai-cells = 0; }; }; diff --git a/arch/arm/boot/dts/exynos4412-odroidu3.dts b/arch/arm/boot/dts/exynos4412-odroidu3.dts index c8a64be..44684e5 100644 --- a/arch/arm/boot/dts/exynos4412-odroidu3.dts +++ b/arch/arm/boot/dts/exynos4412-odroidu3.dts @@ -49,9 +49,11 @@ }; sound { - compatible = samsung,odroidu3-audio; - samsung,model = Odroid-U3; - samsung,audio-routing = + simple-audio-card,name = Odroid-U3; + simple-audio-card,widgets = + Headphone, Headphone Jack, + Speakers, Speakers; + simple-audio-card,routing = Headphone Jack, HPL, Headphone Jack, HPR, Headphone Jack, MICBIAS, diff --git a/arch/arm/boot/dts/exynos4412-odroidx2.dts b/arch/arm/boot/dts/exynos4412-odroidx2.dts index 96b43f4..6e33678 100644 --- a/arch/arm/boot/dts/exynos4412-odroidx2.dts +++ b/arch/arm/boot/dts/exynos4412-odroidx2.dts @@ -23,8 +23,12 @@ }; sound { - samsung,model = Odroid-X2; - samsung,audio-routing = + simple-audio-card,name = Odroid-X2; + simple-audio-card,widgets = + Headphone, Headphone Jack, + Microphone, Mic Jack, + Microphone, DMIC; + simple-audio-card,routing = Headphone Jack, HPL, Headphone Jack, HPR, IN1, Mic Jack, -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH/RFC 13/14] ARM: dts: Exynos4 and Odroid X2/U3 sound device nodes update
Clock related properties are added to the Exynos4 I2S device nodes so they can be referred to as clock providers. Missing i2s_opclk1 clock is added to the I2S0 node and clock properties are added to the MAX98090 codec node to allow it to control/read frequency of the MCLK clock directly. Cc: devicet...@vger.kernel.org Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com --- arch/arm/boot/dts/exynos4.dtsi |6 ++ arch/arm/boot/dts/exynos4412-odroid-common.dtsi |7 +-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi index e0278ec..e1ce457 100644 --- a/arch/arm/boot/dts/exynos4.dtsi +++ b/arch/arm/boot/dts/exynos4.dtsi @@ -61,6 +61,8 @@ reg = 0x0383 0x100; clocks = clock_audss EXYNOS_I2S_BUS; clock-names = iis; + #clock-cells = 1; + clock-output-names = i2s_cdclk0; dmas = pdma0 12, pdma0 11, pdma0 10; dma-names = tx, rx, tx-sec; samsung,idma-addr = 0x0300; @@ -372,6 +374,8 @@ reg = 0x1396 0x100; clocks = clock CLK_I2S1; clock-names = iis; + #clock-cells = 1; + clock-output-names = i2s_cdclk1; dmas = pdma1 12, pdma1 11; dma-names = tx, rx; status = disabled; @@ -382,6 +386,8 @@ reg = 0x1397 0x100; clocks = clock CLK_I2S2; clock-names = iis; + #clock-cells = 1; + clock-output-names = i2s_cdclk2; dmas = pdma0 14, pdma0 13; dma-names = tx, rx; status = disabled; diff --git a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi index b41950f..956737e 100644 --- a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi +++ b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi @@ -37,8 +37,9 @@ pinctrl-names = default; status = okay; clocks = clock_audss EXYNOS_I2S_BUS, -clock_audss EXYNOS_DOUT_AUD_BUS; - clock-names = iis, i2s_opclk0; +clock_audss EXYNOS_DOUT_AUD_BUS, +clock_audss EXYNOS_SCLK_I2S; + clock-names = iis, i2s_opclk0, i2s_opclk1; }; sound: sound { @@ -357,6 +358,8 @@ reg = 0x10; interrupt-parent = gpx0; interrupts = 0 0; + clocks = i2s0 0; + clock-names = mclk; }; }; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCHv2 1/7] devfreq: event: Add new devfreq_event class to provide basic data for devfreq governor
Hi Krzysztof, I replied again this mail because I'll use the mutex for set_event()/get_event() according to your comment. But, of_parse_phandle() seems that this function don't need the of_node_put() function. On 12/11/2014 11:13 AM, Chanwoo Choi wrote: Hi Krzysztof, First of all, thanks for your review. On 12/10/2014 06:37 PM, Krzysztof Kozlowski wrote: On wto, 2014-12-09 at 23:13 +0900, Chanwoo Choi wrote: This patch add new devfreq_event class for devfreq_event device which provide raw data (e.g., memory bus utilization/GPU utilization). This raw data from devfreq_event data would be used for the governor of devfreq subsystem. - devfreq_event device : Provide raw data for governor of existing devfreq device - devfreq device : Monitor device state and change frequency/voltage of device using the raw data from devfreq_event device The devfreq subsystem support generic DVFS(Dynamic Voltage/Frequency Scaling) for Non-CPU Devices. The devfreq device would dertermine current device state using various governor (e.g., ondemand, performance, powersave). After completed determination of system state, devfreq device would change the frequency/voltage of devfreq device according to the result of governor. But, devfreq governor must need basic data which indicates current device state. Existing devfreq subsystem only consider devfreq device which check current system state and determine proper system state using basic data. There is no subsystem for device providing basic data to devfreq device. The devfreq subsystem must need devfreq_event device(data-provider device) for existing devfreq device. So, this patch add new devfreq_event class for devfreq_event device which read various basic data(e.g, memory bus utilization, GPU utilization) and provide measured data to existing devfreq device through standard APIs of devfreq_event class. The following description explains the feature of two kind of devfreq class: - devfreq class (existing) : devfreq consumer device use raw data from devfreq_event device for determining proper current system state and change voltage/frequency dynamically using various governors. - devfreq_event class (new) : Provide measured raw data to devfreq device for governor Cc: MyungJoo Ham myungjoo@samsung.com Cc: Kyungmin Park kyungmin.p...@samsung.com Signed-off-by: Chanwoo Choi cw00.c...@samsung.com --- drivers/devfreq/Kconfig | 2 + drivers/devfreq/Makefile| 5 +- drivers/devfreq/devfreq-event.c | 302 drivers/devfreq/event/Makefile | 1 + include/linux/devfreq.h | 141 +++ 5 files changed, 450 insertions(+), 1 deletion(-) create mode 100644 drivers/devfreq/devfreq-event.c create mode 100644 drivers/devfreq/event/Makefile diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig index faf4e70..4d15b62 100644 --- a/drivers/devfreq/Kconfig +++ b/drivers/devfreq/Kconfig @@ -87,4 +87,6 @@ config ARM_EXYNOS5_BUS_DEVFREQ It reads PPMU counters of memory controllers and adjusts the operating frequencies and voltages with OPP support. +comment DEVFREQ Event Drivers + endif # PM_DEVFREQ diff --git a/drivers/devfreq/Makefile b/drivers/devfreq/Makefile index 16138c9..a1ffabe 100644 --- a/drivers/devfreq/Makefile +++ b/drivers/devfreq/Makefile @@ -1,4 +1,4 @@ -obj-$(CONFIG_PM_DEVFREQ) += devfreq.o +obj-$(CONFIG_PM_DEVFREQ) += devfreq.o devfreq-event.o obj-$(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND) += governor_simpleondemand.o obj-$(CONFIG_DEVFREQ_GOV_PERFORMANCE) += governor_performance.o obj-$(CONFIG_DEVFREQ_GOV_POWERSAVE)+= governor_powersave.o @@ -7,3 +7,6 @@ obj-$(CONFIG_DEVFREQ_GOV_USERSPACE) += governor_userspace.o # DEVFREQ Drivers obj-$(CONFIG_ARM_EXYNOS4_BUS_DEVFREQ) += exynos/ obj-$(CONFIG_ARM_EXYNOS5_BUS_DEVFREQ) += exynos/ + +# DEVFREQ Event Drivers +obj-$(CONFIG_PM_DEVFREQ) += event/ diff --git a/drivers/devfreq/devfreq-event.c b/drivers/devfreq/devfreq-event.c new file mode 100644 index 000..b47329f --- /dev/null +++ b/drivers/devfreq/devfreq-event.c @@ -0,0 +1,302 @@ +/* + * devfreq-event: Generic DEVFREQ Event class driver + * + * Copyright (C) 2014 Samsung Electronics + * Chanwoo Choi cw00.c...@samsung.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This driver is based on drivers/devfreq/devfreq.c + */ + +#include linux/kernel.h +#include linux/sched.h +#include linux/errno.h +#include linux/err.h +#include linux/init.h +#include linux/module.h +#include linux/slab.h +#include linux/stat.h +#include linux/pm_opp.h +#include linux/devfreq.h +#include linux/workqueue.h +#include
Re: [PATCH v5 1/2] soc: samsung: add exynos chipid driver support
Hi Rob, On Thursday 11 December 2014 11:00 PM, Rob Herring wrote: On Thu, Dec 11, 2014 at 2:07 AM, Pankaj Dubey pankaj.du...@samsung.com wrote: Exynos SoCs have Chipid, for identification of product IDs and SoC revisions. This patch intendes to provide initialization code for all these functionalites. This driver usese existing binding for exnos-chipid. s/usese/uses/ s/exnos/exynos/ I'll fix this. CC: Grant Likely grant.lik...@linaro.org CC: Rob Herring robh...@kernel.org CC: Linus Walleij linus.wall...@linaro.org Signed-off-by: Pankaj Dubey pankaj.du...@samsung.com --- drivers/soc/Kconfig| 1 + drivers/soc/Makefile | 1 + drivers/soc/samsung/Kconfig| 14 +++ drivers/soc/samsung/Makefile | 1 + drivers/soc/samsung/exynos-chipid.c| 168 + include/linux/soc/samsung/exynos-soc.h | 51 ++ 6 files changed, 236 insertions(+) create mode 100644 drivers/soc/samsung/Kconfig create mode 100644 drivers/soc/samsung/Makefile create mode 100644 drivers/soc/samsung/exynos-chipid.c create mode 100644 include/linux/soc/samsung/exynos-soc.h diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig index 76d6bd4..c3abfbe 100644 --- a/drivers/soc/Kconfig +++ b/drivers/soc/Kconfig @@ -1,6 +1,7 @@ menu SOC (System On Chip) specific Drivers source drivers/soc/qcom/Kconfig +source drivers/soc/samsung/Kconfig source drivers/soc/ti/Kconfig source drivers/soc/versatile/Kconfig diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile index 063113d..620366f 100644 --- a/drivers/soc/Makefile +++ b/drivers/soc/Makefile @@ -3,6 +3,7 @@ # obj-$(CONFIG_ARCH_QCOM)+= qcom/ +obj-$(CONFIG_SOC_SAMSUNG) += samsung/ obj-$(CONFIG_ARCH_TEGRA) += tegra/ obj-$(CONFIG_SOC_TI) += ti/ obj-$(CONFIG_PLAT_VERSATILE) += versatile/ diff --git a/drivers/soc/samsung/Kconfig b/drivers/soc/samsung/Kconfig new file mode 100644 index 000..2d83652 --- /dev/null +++ b/drivers/soc/samsung/Kconfig @@ -0,0 +1,14 @@ +# +# SAMSUNG SoC drivers +# +menu Samsung SOC driver support + +config SOC_SAMSUNG + bool + +config EXYNOS_CHIPID + bool + depends on ARCH_EXYNOS + select SOC_BUS This is going to show an empty menu when ARCH_EXYNOS is not enabled. The whole menu should probably have if ARCH_EXYNOS instead. OK, I can add 'depends on ARCH_EXYNOS' for menu above so that it should not show empty menu option if ARCH_EXNOS is not enabled. + +endmenu diff --git a/drivers/soc/samsung/Makefile b/drivers/soc/samsung/Makefile new file mode 100644 index 000..855ca05 --- /dev/null +++ b/drivers/soc/samsung/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_EXYNOS_CHIPID)+= exynos-chipid.o diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c new file mode 100644 index 000..8968f83 --- /dev/null +++ b/drivers/soc/samsung/exynos-chipid.c @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * http://www.samsung.com/ + * + * EXYNOS - CHIP ID support + * Author: Pankaj Dubey pankaj.du...@samsung.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include linux/io.h +#include linux/of.h +#include linux/of_address.h +#include linux/of_platform.h +#include linux/platform_device.h +#include linux/slab.h +#include linux/sys_soc.h +#include linux/soc/samsung/exynos-soc.h + +#define EXYNOS_SUBREV_MASK (0xF 4) +#define EXYNOS_MAINREV_MASK(0xF 0) +#define EXYNOS_REV_MASK(EXYNOS_SUBREV_MASK | EXYNOS_MAINREV_MASK) + +static void __iomem *exynos_chipid_base; + +struct exynos_chipid_info exynos_soc_info; +EXPORT_SYMBOL(exynos_soc_info); The soc_device already has similar data.Why is this needed? Is it temporary for compatibility? struct soc_device_attribute can hold these two (product_id, and revision) but they are defined as char * in soc_device_atttribute, and I feel it's more specific for exposing via sysfs. Also existing code in mach-exynos compares them via product_id/revision macros, so I can say to keep compatibility. For early use? Yes, partially correct. These parameters will be required in during early boot, from mach-exynos/platsmp.c, by that time probe of chipid would not have happened. But usage of this is not limited to early users, even mach-exynos/pm.c will use this later any point of time. Since there are early users I added exynos_chipid_early_init which will be called via mach-exynos.c at very early stage [1]. [1]: https://lkml.org/lkml/2014/12/11/47 If for early use, then it should not be exported. Other reason to make and expose this structure was we can see that other fields of chipid bank (other than product_id and revision, which is not part of this patch as of now) can be used