From: Vincent Palatin Date: Wed, 6 Feb 2013 19:05:28 +0000 (-0800) Subject: CHROMIUM: exynos: enable ADCs only if there are used X-Git-Url: http://git.cascardo.eti.br/?a=commitdiff_plain;h=7c61172e4ceb5eee4276fc2869b08b72fa9fba7e;p=cascardo%2Flinux.git CHROMIUM: exynos: enable ADCs only if there are used Check the presence of an ADC node in the device tree before activating the ADCs and the NTP thermistors connected to them. Signed-off-by: Vincent Palatin BUG=chrome-os-partner:16430 TEST=on Spring with SLSI PMIC, boot with adc node de-activated and doesn't see any ADC related panic. on Snow, boot and check the thermistor temperatures in sysfs. Change-Id: I1603d78805a8d0877c137b92bcd2c64cbb32564d Reviewed-on: https://gerrit.chromium.org/gerrit/42868 Commit-Queue: Vincent Palatin Tested-by: Vincent Palatin Reviewed-by: Vincent Palatin --- diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c index afb76e3fddb8..eab7d4156463 100644 --- a/arch/arm/mach-exynos/mach-exynos5-dt.c +++ b/arch/arm/mach-exynos/mach-exynos5-dt.c @@ -939,13 +939,16 @@ static struct platform_device *smdk5250_devices[] __initdata = { #ifdef CONFIG_DRM_EXYNOS_HDMI &exynos_drm_hdmi_device, #endif +#ifdef CONFIG_BUSFREQ_OPP + &exynos5_busfreq, +#endif +}; + +static struct platform_device *thermistor_devices[] __initdata = { &s3c_device_adc_ntc_thermistor0, &s3c_device_adc_ntc_thermistor1, &s3c_device_adc_ntc_thermistor2, &s3c_device_adc_ntc_thermistor3, -#ifdef CONFIG_BUSFREQ_OPP - &exynos5_busfreq, -#endif }; static struct regulator_consumer_supply dummy_supplies[] = { @@ -1168,13 +1171,19 @@ static void __init exynos5250_dt_machine_init(void) #endif s5p_tv_setup(); - /* Enable power to ADC */ - __raw_writel(0x1, S5P_ADC_PHY_CONTROL); + np = of_find_compatible_node(NULL, NULL, "samsung,exynos5-adc"); + if (np && of_device_is_available(np)) { + /* Enable power to ADC */ + __raw_writel(0x1, S5P_ADC_PHY_CONTROL); - s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor0); - s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor1); - s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor2); - s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor3); + s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor0); + s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor1); + s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor2); + s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor3); + + platform_add_devices(thermistor_devices, + ARRAY_SIZE(thermistor_devices)); + } #ifdef CONFIG_BUSFREQ_OPP dev_add(&busfreq, &exynos5_busfreq.dev);