From e2caaebe56849de50fdf977c2fff8c77cd55a795 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Tue, 9 Jun 2015 13:18:22 +0200 Subject: apalis_t30: clean-up board file --- arch/arm/mach-tegra/board-apalis_t30.c | 460 +++++++++++++++++---------------- 1 file changed, 238 insertions(+), 222 deletions(-) diff --git a/arch/arm/mach-tegra/board-apalis_t30.c b/arch/arm/mach-tegra/board-apalis_t30.c index 1f3f84ad132f..52120ef62c2a 100644 --- a/arch/arm/mach-tegra/board-apalis_t30.c +++ b/arch/arm/mach-tegra/board-apalis_t30.c @@ -1,7 +1,7 @@ /* * arch/arm/mach-tegra/board-apalis_t30.c * - * Copyright (c) 2013-2014 Toradex, Inc. + * Copyright (c) 2013-2015 Toradex, Inc. * * This source code is licensed under the GNU General Public License, * Version 2. See the file COPYING for more details. @@ -12,10 +12,10 @@ #include #include -#include /* required by linux/gpio_keys.h */ #include #include #include +#include #include #include #include @@ -40,7 +40,6 @@ #include #include -#include #include "board-apalis_t30.h" #include "board.h" @@ -57,11 +56,17 @@ /* I2S */ static struct tegra_asoc_platform_data apalis_t30_audio_sgtl5000_pdata = { - .gpio_spkr_en = -1, + .gpio_ext_mic_en = -1, .gpio_hp_det = -1, .gpio_hp_mute = -1, .gpio_int_mic_en = -1, - .gpio_ext_mic_en = -1, + .gpio_spkr_en = -1, + .i2s_param[BASEBAND] = { + .audio_port_id = -1, + }, + .i2s_param[BT_SCO] = { + .audio_port_id = -1, + }, .i2s_param[HIFI_CODEC] = { .audio_port_id = 1, /* index of below registered tegra_i2s_device plus one if HDA codec @@ -70,28 +75,22 @@ static struct tegra_asoc_platform_data apalis_t30_audio_sgtl5000_pdata = { .is_i2s_master = 1, .sample_size = 16, }, - .i2s_param[BASEBAND] = { - .audio_port_id = -1, - }, - .i2s_param[BT_SCO] = { - .audio_port_id = -1, - }, }; static struct platform_device apalis_t30_audio_sgtl5000_device = { - .name = "tegra-snd-apalis_t30-sgtl5000", - .id = 0, .dev = { .platform_data = &apalis_t30_audio_sgtl5000_pdata, }, + .id = 0, + .name = "tegra-snd-apalis_t30-sgtl5000", }; /* Camera */ #ifdef CONFIG_TEGRA_CAMERA static struct platform_device tegra_camera = { - .name = "tegra_camera", .id = -1, + .name = "tegra_camera", }; #endif /* CONFIG_TEGRA_CAMERA */ @@ -105,44 +104,12 @@ static int tegra_camera_enable(struct nvhost_device *ndev) return 0; } -#if defined(CONFIG_SOC_CAMERA_MAX9526) || defined(CONFIG_SOC_CAMERA_MAX9526_MODULE) -static struct i2c_board_info camera_i2c_max9526 = { - I2C_BOARD_INFO("max9526", 0x20), -}; - -static struct tegra_camera_platform_data max9526_tegra_camera_platform_data = { - .disable_camera = tegra_camera_disable, - .enable_camera = tegra_camera_enable, - .flip_h = 0, - .flip_v = 0, - .port = TEGRA_CAMERA_PORT_VIP, - .internal_sync = false, - .vip_h_active_start = 0x8F, - .vip_v_active_start = 0x12, -}; - -static struct soc_camera_link iclink_max9526 = { - .board_info = &camera_i2c_max9526, - .bus_id = -1, /* This must match the .id of tegra_vi01_device */ - .priv = &max9526_tegra_camera_platform_data, - .i2c_adapter_id = 2, -}; - -static struct platform_device soc_camera_max9526 = { - .name = "soc-camera-pdrv", - .id = 0, - .dev = { - .platform_data = &iclink_max9526, - }, -}; -#endif /* CONFIG_SOC_CAMERA_MAX9526 | CONFIG_SOC_CAMERA_MAX9526_MODULE */ - #if defined(CONFIG_VIDEO_ADV7180) || defined(CONFIG_VIDEO_ADV7180_MODULE) static struct i2c_board_info camera_i2c_adv7180 = { I2C_BOARD_INFO("adv7180", 0x21), }; -static struct tegra_camera_platform_data adv7180_tegra_camera_platform_data = { +static struct tegra_camera_platform_data adv7180_platform_data = { .disable_camera = tegra_camera_disable, .enable_camera = tegra_camera_enable, .flip_h = 0, @@ -156,16 +123,16 @@ static struct tegra_camera_platform_data adv7180_tegra_camera_platform_data = { static struct soc_camera_link iclink_adv7180 = { .board_info = &camera_i2c_adv7180, .bus_id = -1, /* This must match the .id of tegra_vi01_device */ - .priv = &adv7180_tegra_camera_platform_data, .i2c_adapter_id = 2, + .priv = &adv7180_platform_data, }; static struct platform_device soc_camera_adv7180 = { - .name = "soc-camera-pdrv", - .id = 1, - .dev = { + .dev = { .platform_data = &iclink_adv7180, }, + .id = 0, + .name = "soc-camera-pdrv", }; #endif /* CONFIG_VIDEO_ADV7180 | CONFIG_VIDEO_ADV7180_MODULE */ @@ -174,77 +141,118 @@ static struct i2c_board_info camera_i2c_adv7280 = { I2C_BOARD_INFO("adv7280", 0x21), }; -static struct tegra_camera_platform_data adv7280_tegra_camera_platform_data = { +static struct tegra_camera_platform_data adv7280_platform_data = { .disable_camera = tegra_camera_disable, .enable_camera = tegra_camera_enable, - .flip_h = 0, - .flip_v = 0, - .port = TEGRA_CAMERA_PORT_VIP, + .flip_h = 0, + .flip_v = 0, .internal_sync = false, + .port = TEGRA_CAMERA_PORT_VIP, .vip_h_active_start = 0x44, - .vip_v_active_start = 0x27, + .vip_v_active_start = 0x27, }; static struct soc_camera_link iclink_adv7280 = { .board_info = &camera_i2c_adv7280, .bus_id = -1, /* This must match the .id of tegra_vi01_device */ - .priv = &adv7280_tegra_camera_platform_data, .i2c_adapter_id = 2, + .priv = &adv7280_platform_data, }; static struct platform_device soc_camera_adv7280 = { - .name = "soc-camera-pdrv", - .id = 2, - .dev = { + .dev = { .platform_data = &iclink_adv7280, }, + .id = 1, + .name = "soc-camera-pdrv", }; #endif /* CONFIG_VIDEO_ADV7280 | CONFIG_VIDEO_ADV7280_MODULE */ -#if defined(CONFIG_SOC_CAMERA_TVP5150) || defined(CONFIG_SOC_CAMERA_TVP5150_MODULE) -static struct i2c_board_info camera_i2c_tvp5150soc = { - I2C_BOARD_INFO("tvp5150soc", 0x5d), +#if defined(CONFIG_SOC_CAMERA_AS0260) || \ + defined(CONFIG_SOC_CAMERA_AS0260_MODULE) +static struct i2c_board_info camera_i2c_as0260soc = { + I2C_BOARD_INFO("as0260soc", 0x48), }; -static struct tegra_camera_platform_data tvp5150soc_tegra_camera_platform_data = { +static struct tegra_camera_platform_data as0260soc_platform_data = { + .continuous_clk = true, + .disable_camera = tegra_camera_disable, + .enable_camera = tegra_camera_enable, + .flip_h = 0, + .flip_v = 0, + .internal_sync = false, + .lanes = 2, + .port = TEGRA_CAMERA_PORT_CSI_A, +// .port = TEGRA_CAMERA_PORT_CSI_B, +// .port = TEGRA_CAMERA_PORT_VIP, + .vip_h_active_start = 0, +// .vip_h_active_start = 8F, + .vip_v_active_start = 0, +// .vip_v_active_start = 12, +}; + +static struct soc_camera_link iclink_as0260soc = { + .board_info = &camera_i2c_as0260soc, + .bus_id = -1, /* This must match the .id of tegra_vi01_device */ + .i2c_adapter_id = 2, + .priv = &as0260soc_platform_data, +}; + +static struct platform_device soc_camera_as0260soc = { + .dev = { + .platform_data = &iclink_as0260soc, + }, + .id = 2, + .name = "soc-camera-pdrv", +}; +#endif /* CONFIG_SOC_CAMERA_AS0260 | CONFIG_SOC_CAMERA_AS0260_MODULE */ + +#if defined(CONFIG_SOC_CAMERA_MAX9526) || \ + defined(CONFIG_SOC_CAMERA_MAX9526_MODULE) +static struct i2c_board_info camera_i2c_max9526 = { + I2C_BOARD_INFO("max9526", 0x20), +}; + +static struct tegra_camera_platform_data max9526_platform_data = { .disable_camera = tegra_camera_disable, .enable_camera = tegra_camera_enable, .flip_h = 0, .flip_v = 0, - .port = TEGRA_CAMERA_PORT_VIP, .internal_sync = false, + .port = TEGRA_CAMERA_PORT_VIP, .vip_h_active_start = 0x8F, .vip_v_active_start = 0x12, }; -static struct soc_camera_link iclink_tvp5150soc = { - .board_info = &camera_i2c_tvp5150soc, +static struct soc_camera_link iclink_max9526 = { + .board_info = &camera_i2c_max9526, .bus_id = -1, /* This must match the .id of tegra_vi01_device */ - .priv = &tvp5150soc_tegra_camera_platform_data, .i2c_adapter_id = 2, + .priv = &max9526_platform_data, }; -static struct platform_device soc_camera_tvp5150soc = { - .name = "soc-camera-pdrv", - .id = 3, - .dev = { - .platform_data = &iclink_tvp5150soc, +static struct platform_device soc_camera_max9526 = { + .dev = { + .platform_data = &iclink_max9526, }, + .id = 3, + .name = "soc-camera-pdrv", }; -#endif /* CONFIG_SOC_CAMERA_TVP5150 | CONFIG_SOC_CAMERA_TVP5150_MODULE */ +#endif /* CONFIG_SOC_CAMERA_MAX9526 | CONFIG_SOC_CAMERA_MAX9526_MODULE */ -#if defined(CONFIG_SOC_CAMERA_OV7670SOC) || defined(CONFIG_SOC_CAMERA_OV7670SOC_MODULE) +#if defined(CONFIG_SOC_CAMERA_OV7670SOC) || \ + defined(CONFIG_SOC_CAMERA_OV7670SOC_MODULE) static struct i2c_board_info camera_i2c_ov7670soc = { I2C_BOARD_INFO("ov7670soc", 0x21), }; -static struct tegra_camera_platform_data ov7670_tegra_camera_platform_data = { +static struct tegra_camera_platform_data ov7670_platform_data = { .disable_camera = tegra_camera_disable, .enable_camera = tegra_camera_enable, .flip_h = 0, .flip_v = 0, - .port = TEGRA_CAMERA_PORT_VIP, .internal_sync = false, + .port = TEGRA_CAMERA_PORT_VIP, .vip_h_active_start = 0x8F, .vip_v_active_start = 0x12, }; @@ -252,56 +260,51 @@ static struct tegra_camera_platform_data ov7670_tegra_camera_platform_data = { static struct soc_camera_link iclink_ov7670soc = { .board_info = &camera_i2c_ov7670soc, .bus_id = -1, /* This must match the .id of tegra_vi01_device */ - .priv = &ov7670_tegra_camera_platform_data, .i2c_adapter_id = 2, + .priv = &ov7670_platform_data, }; static struct platform_device soc_camera_ov7670soc = { - .name = "soc-camera-pdrv", - .id = 4, - .dev = { + .dev = { .platform_data = &iclink_ov7670soc, }, + .id = 4, + .name = "soc-camera-pdrv", }; #endif /* CONFIG_SOC_CAMERA_OV7670SOC | CONFIG_SOC_CAMERA_OV7670SOC_MODULE */ -#if defined(CONFIG_SOC_CAMERA_AS0260) || defined(CONFIG_SOC_CAMERA_AS0260_MODULE) -static struct i2c_board_info camera_i2c_as0260soc = { - I2C_BOARD_INFO("as0260soc", 0x48), +#if defined(CONFIG_SOC_CAMERA_TVP5150) || \ + defined(CONFIG_SOC_CAMERA_TVP5150_MODULE) +static struct i2c_board_info camera_i2c_tvp5150soc = { + I2C_BOARD_INFO("tvp5150soc", 0x5d), }; -static struct tegra_camera_platform_data as0260soc_tegra_camera_platform_data = { +static struct tegra_camera_platform_data tvp5150soc_platform_data = { .disable_camera = tegra_camera_disable, .enable_camera = tegra_camera_enable, .flip_h = 0, .flip_v = 0, - .port = TEGRA_CAMERA_PORT_CSI_A, -// .port = TEGRA_CAMERA_PORT_CSI_B, -// .port = TEGRA_CAMERA_PORT_VIP, - .lanes = 2, - .continuous_clk = true, .internal_sync = false, - .vip_h_active_start = 0, -// .vip_h_active_start = 8F, - .vip_v_active_start = 0, -// .vip_v_active_start = 12, + .port = TEGRA_CAMERA_PORT_VIP, + .vip_h_active_start = 0x8F, + .vip_v_active_start = 0x12, }; -static struct soc_camera_link iclink_as0260soc = { - .board_info = &camera_i2c_as0260soc, +static struct soc_camera_link iclink_tvp5150soc = { + .board_info = &camera_i2c_tvp5150soc, .bus_id = -1, /* This must match the .id of tegra_vi01_device */ - .priv = &as0260soc_tegra_camera_platform_data, .i2c_adapter_id = 2, + .priv = &tvp5150soc_platform_data, }; -static struct platform_device soc_camera_as0260soc = { - .name = "soc-camera-pdrv", - .id = 5, - .dev = { - .platform_data = &iclink_as0260soc, +static struct platform_device soc_camera_tvp5150soc = { + .dev = { + .platform_data = &iclink_tvp5150soc, }, + .id = 5, + .name = "soc-camera-pdrv", }; -#endif /* CONFIG_SOC_CAMERA_AS0260 | CONFIG_SOC_CAMERA_AS0260_MODULE */ +#endif /* CONFIG_SOC_CAMERA_TVP5150 | CONFIG_SOC_CAMERA_TVP5150_MODULE */ #endif /* CONFIG_VIDEO_TEGRA | CONFIG_VIDEO_TEGRA_MODULE */ @@ -355,39 +358,39 @@ static void __init apalis_t30_mcp2515_can_init(void) /* Clocks */ static struct tegra_clk_init_table apalis_t30_clk_init_table[] __initdata = { - /* name parent rate enabled */ - {"apbif", "clk_m", 12000000, false}, - {"audio0", "i2s0_sync", 0, false}, - {"audio1", "i2s1_sync", 0, false}, - {"audio2", "i2s2_sync", 0, false}, - {"audio3", "i2s3_sync", 0, false}, - {"audio4", "i2s4_sync", 0, false}, - {"blink", "clk_32k", 32768, true}, + /* name parent rate enabled */ + {"apbif", "clk_m", 12000000, false}, + {"audio0", "i2s0_sync", 0, false}, + {"audio1", "i2s1_sync", 0, false}, + {"audio2", "i2s2_sync", 0, false}, + {"audio3", "i2s3_sync", 0, false}, + {"audio4", "i2s4_sync", 0, false}, + {"blink", "clk_32k", 32768, true}, /* required for vi_sensor ? */ - {"csus", "clk_m", 0, true}, - {"d_audio", "clk_m", 12000000, false}, - {"dam0", "clk_m", 12000000, false}, - {"dam1", "clk_m", 12000000, false}, - {"dam2", "clk_m", 12000000, false}, - {"hda", "pll_p", 108000000, false}, - {"hda2codec_2x","pll_p", 48000000, false}, - {"i2c1", "pll_p", 3200000, false}, - {"i2c2", "pll_p", 3200000, false}, - {"i2c3", "pll_p", 3200000, false}, - {"i2c4", "pll_p", 3200000, false}, - {"i2c5", "pll_p", 3200000, false}, - {"i2s0", "pll_a_out0", 0, false}, - {"i2s1", "pll_a_out0", 0, false}, - {"i2s2", "pll_a_out0", 0, false}, - {"i2s3", "pll_a_out0", 0, false}, - {"i2s4", "pll_a_out0", 0, false}, - {"pll_a", NULL, 564480000, true}, - {"pll_m", NULL, 0, false}, - {"pwm", "pll_p", 3187500, false}, - {"spdif_out", "pll_a_out0", 0, false}, - {"vi", "pll_p", 0, false}, - {"vi_sensor", "pll_p", 150000000, false}, - {NULL, NULL, 0, 0}, + {"csus", "clk_m", 0, true}, + {"d_audio", "clk_m", 12000000, false}, + {"dam0", "clk_m", 12000000, false}, + {"dam1", "clk_m", 12000000, false}, + {"dam2", "clk_m", 12000000, false}, + {"hda", "pll_p", 108000000, false}, + {"hda2codec_2x", "pll_p", 48000000, false}, + {"i2c1", "pll_p", 3200000, false}, + {"i2c2", "pll_p", 3200000, false}, + {"i2c3", "pll_p", 3200000, false}, + {"i2c4", "pll_p", 3200000, false}, + {"i2c5", "pll_p", 3200000, false}, + {"i2s0", "pll_a_out0", 0, false}, + {"i2s1", "pll_a_out0", 0, false}, + {"i2s2", "pll_a_out0", 0, false}, + {"i2s3", "pll_a_out0", 0, false}, + {"i2s4", "pll_a_out0", 0, false}, + {"pll_a", NULL, 564480000, true}, + {"pll_m", NULL, 0, false}, + {"pwm", "pll_p", 3187500, false}, + {"spdif_out", "pll_a_out0", 0, false}, + {"vi", "pll_p", 0, false}, + {"vi_sensor", "pll_p", 150000000, false}, + {NULL, NULL, 0, 0}, }; /* GPIO */ @@ -428,8 +431,8 @@ static void apalis_t30_gpio_init(void) apalis_t30_gpios[i].label); if (err) { - pr_warning("gpio_request(%s) failed, err = %d", - apalis_t30_gpios[i].label, err); + pr_warn("gpio_request(%s) failed, err = %d", + apalis_t30_gpios[i].label, err); } else { gpio_export(apalis_t30_gpios[i].gpio, true); } @@ -437,7 +440,7 @@ static void apalis_t30_gpio_init(void) } /* - * Fusion touch screen GPIOs (using Toradex display/touch adapater) + * Fusion touch screen GPIOs (using Toradex display/touch adapter) * Apalis GPIO 5, MXM-11, Ixora X27-17, pen down interrupt * Apalis GPIO 6, MXM-13, Ixora X27-18, reset * gpio_request muxes the GPIO function automatically, we only have to make @@ -446,9 +449,9 @@ static void apalis_t30_gpio_init(void) static int pinmux_fusion_pins(void); static struct fusion_f0710a_init_data apalis_fusion_pdata = { - .pinmux_fusion_pins = &pinmux_fusion_pins, - .gpio_int = APALIS_GPIO5, /* MXM-11, Pen down interrupt */ - .gpio_reset = APALIS_GPIO6, /* MXM-13, Reset interrupt */ + .gpio_int = APALIS_GPIO5, /* MXM-11, Pen down interrupt */ + .gpio_reset = APALIS_GPIO6, /* MXM-13, Reset interrupt */ + .pinmux_fusion_pins = &pinmux_fusion_pins, }; static int pinmux_fusion_pins(void) @@ -456,6 +459,7 @@ static int pinmux_fusion_pins(void) gpio_free(apalis_fusion_pdata.gpio_int); gpio_free(apalis_fusion_pdata.gpio_reset); apalis_fusion_pdata.pinmux_fusion_pins = NULL; + return 0; } @@ -474,7 +478,7 @@ static struct i2c_board_info apalis_t30_i2c_bus1_board_info[] __initdata = { { /* TouchRevolution Fusion 7 and 10 multi-touch controller */ I2C_BOARD_INFO("fusion_F0710A", 0x10), - .platform_data = &apalis_fusion_pdata, + .platform_data = &apalis_fusion_pdata, }, }; @@ -532,19 +536,19 @@ static struct stmpe_ts_platform_data stmpe811_ts_data = { /* STMPE811 ADC controller */ static struct stmpe_adc_platform_data stmpe811_adc_data = { - .sample_time = 4, /* ADC converstion time: 80 clocks */ + .adc_freq = 1, /* 3.25 MHz ADC clock speed */ .mod_12b = 1, /* 12-bit ADC */ .ref_sel = 0, /* internal ADC reference */ - .adc_freq = 1, /* 3.25 MHz ADC clock speed */ + .sample_time = 4, /* ADC converstion time: 80 clocks */ }; static struct stmpe_platform_data stmpe811_data = { + .adc = &stmpe811_adc_data, .blocks = STMPE_BLOCK_TOUCHSCREEN | STMPE_BLOCK_ADC, .id = 1, .irq_base = STMPE811_IRQ_BASE, .irq_trigger = IRQF_TRIGGER_FALLING, .ts = &stmpe811_ts_data, - .adc = &stmpe811_adc_data, }; static void lm95245_probe_callback(struct device *dev); @@ -620,13 +624,13 @@ static void __init apalis_t30_i2c_init(void) #ifdef CONFIG_KEYBOARD_GPIO #define GPIO_KEY(_id, _gpio, _lowactive, _iswake) \ { \ - .code = _id, \ - .gpio = TEGRA_GPIO_##_gpio, \ .active_low = _lowactive, \ + .code = _id, \ + .debounce_interval = 10, \ .desc = #_id, \ + .gpio = TEGRA_GPIO_##_gpio, \ .type = EV_KEY, \ .wakeup = _iswake, \ - .debounce_interval = 10, \ } static struct gpio_keys_button apalis_t30_keys[] = { @@ -644,11 +648,11 @@ static struct gpio_keys_platform_data apalis_t30_keys_platform_data = { }; static struct platform_device apalis_t30_keys_device = { - .name = "gpio-keys", - .id = 0, .dev = { .platform_data = &apalis_t30_keys_platform_data, }, + .id = 0, + .name = "gpio-keys", }; #endif /* CONFIG_KEYBOARD_GPIO */ @@ -722,7 +726,7 @@ static void __init apalis_t30_sdhci_init(void) The default link speed setting is 5 GT/s (GEN2). 0x98 is the Link Control 2 PCIe Capability Register of the PEX8605 PCIe switch. The switch supports link speed auto negotiation, but falsely sets the link speed to 5 GT/s. */ -static void __devinit quirk_apalis_plx_gen1(struct pci_dev *dev) +static void quirk_apalis_plx_gen1(struct pci_dev *dev) { pci_write_config_dword(dev, 0x98, 0x01); mdelay(50); @@ -730,11 +734,11 @@ static void __devinit quirk_apalis_plx_gen1(struct pci_dev *dev) DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8605, quirk_apalis_plx_gen1); static struct tegra_pci_platform_data apalis_t30_pci_platform_data = { + .gpio = 0, .port_status[0] = 1, .port_status[1] = 1, .port_status[2] = 1, .use_dock_detect = 0, - .gpio = 0, }; static void apalis_t30_pci_init(void) @@ -750,7 +754,7 @@ static void apalis_t30_pci_init(void) gpio_set_value(PEX_PERST_N, 1); /* Err_5: PEX_REFCLK_OUTpx/nx Clock Outputs is not Guaranteed Until 900 us After PEX_PERST# De-assertion */ - msleep(1); + mdelay(1); gpio_set_value(RESET_MOCI_N, 1); tegra_pci_device.dev.platform_data = &apalis_t30_pci_platform_data; @@ -760,36 +764,36 @@ static void apalis_t30_pci_init(void) /* PWM LEDs */ static struct led_pwm tegra_leds_pwm[] = { { + .max_brightness = 255, .name = "PWM3", .pwm_id = 1, - .max_brightness = 255, .pwm_period_ns = 19600, }, { + .max_brightness = 255, .name = "PWM2", .pwm_id = 2, - .max_brightness = 255, .pwm_period_ns = 19600, }, { + .max_brightness = 255, .name = "PWM1", .pwm_id = 3, - .max_brightness = 255, .pwm_period_ns = 19600, }, }; static struct led_pwm_platform_data tegra_leds_pwm_data = { - .num_leds = ARRAY_SIZE(tegra_leds_pwm), .leds = tegra_leds_pwm, + .num_leds = ARRAY_SIZE(tegra_leds_pwm), }; static struct platform_device tegra_led_pwm_device = { - .name = "leds_pwm", - .id = -1, .dev = { .platform_data = &tegra_leds_pwm_data, }, + .id = -1, + .name = "leds_pwm", }; /* RTC */ @@ -797,22 +801,22 @@ static struct platform_device tegra_led_pwm_device = { #ifdef CONFIG_RTC_DRV_TEGRA static struct resource tegra_rtc_resources[] = { [0] = { - .start = TEGRA_RTC_BASE, .end = TEGRA_RTC_BASE + TEGRA_RTC_SIZE - 1, .flags = IORESOURCE_MEM, + .start = TEGRA_RTC_BASE, }, [1] = { - .start = INT_RTC, .end = INT_RTC, .flags = IORESOURCE_IRQ, + .start = INT_RTC, }, }; static struct platform_device tegra_rtc_device = { - .name = "tegra_rtc", .id = -1, - .resource = tegra_rtc_resources, + .name = "tegra_rtc", .num_resources = ARRAY_SIZE(tegra_rtc_resources), + .resource = tegra_rtc_resources, }; #endif /* CONFIG_RTC_DRV_TEGRA */ @@ -821,24 +825,24 @@ static struct platform_device tegra_rtc_device = { #ifdef CONFIG_SATA_AHCI_TEGRA static struct gpio_led apalis_gpio_leds[] = { [0] = { - .name = "SATA1_ACT_N", + .active_low = 1, .default_trigger = "ide-disk", .gpio = SATA1_ACT_N, - .active_low = 1, + .name = "SATA1_ACT_N", .retain_state_suspended = 0, }, }; static struct gpio_led_platform_data apalis_gpio_led_data = { - .num_leds = ARRAY_SIZE(apalis_gpio_leds), .leds = apalis_gpio_leds, + .num_leds = ARRAY_SIZE(apalis_gpio_leds), }; static struct platform_device apalis_led_gpio_device = { - .name = "leds-gpio", .dev = { .platform_data = &apalis_gpio_led_data, }, + .name = "leds-gpio", }; static void apalis_t30_sata_init(void) @@ -909,9 +913,9 @@ static struct spi_clk_parent spi_parent_clk[] = { }; static struct tegra_spi_platform_data apalis_t30_spi_pdata = { + .is_clkon_always = false, .is_dma_based = true, .max_dma_buffer = 16 * 1024, - .is_clkon_always = false, .max_rate = 100000000, }; @@ -924,7 +928,7 @@ static void __init apalis_t30_spi_init(void) c = tegra_get_clock_by_name(spi_parent_clk[i].name); if (IS_ERR_OR_NULL(c)) { pr_err("Not able to get the clock for %s\n", - spi_parent_clk[i].name); + spi_parent_clk[i].name); continue; } spi_parent_clk[i].parent_clk = c; @@ -934,18 +938,18 @@ static void __init apalis_t30_spi_init(void) apalis_t30_spi_pdata.parent_clk_count = ARRAY_SIZE(spi_parent_clk); tegra_spi_device1.dev.platform_data = &apalis_t30_spi_pdata; platform_add_devices(apalis_t30_spi_devices, - ARRAY_SIZE(apalis_t30_spi_devices)); + ARRAY_SIZE(apalis_t30_spi_devices)); } /* Thermal throttling */ static void *apalis_t30_alert_data; static void (*apalis_t30_alert_func)(void *); -static int apalis_t30_low_edge = 0; -static int apalis_t30_low_hysteresis = 3000; -static int apalis_t30_low_limit = 0; -static struct device *lm95245_device = NULL; -static int thermd_alert_irq_disabled = 0; +static int apalis_t30_low_edge; +static int apalis_t30_low_hysteresis; +static int apalis_t30_low_limit; +static struct device *lm95245_device; +static int thermd_alert_irq_disabled; struct work_struct thermd_alert_work; struct workqueue_struct *thermd_alert_workqueue; @@ -1079,46 +1083,53 @@ static int lm95245_get_temp(void *_data, long *temp) { struct device *lm95245_device = _data; int lm95245_temp = 0; + lm95245_get_remote_temp(lm95245_device, &lm95245_temp); *temp = lm95245_temp; + return 0; } static int lm95245_get_temp_low(void *_data, long *temp) { *temp = 0; + return 0; } /* Our temperature sensor only allows triggering an interrupt on over- temperature shutdown aka the high limit we therefore need to setup a workqueue to catch leaving the low limit. */ -static int lm95245_set_limits(void *_data, - long lo_limit_milli, - long hi_limit_milli) +static int lm95245_set_limits(void *_data, long lo_limit_milli, + long hi_limit_milli) { struct device *lm95245_device = _data; + apalis_t30_low_limit = lo_limit_milli; - if (lm95245_device) lm95245_set_remote_os_limit(lm95245_device, - hi_limit_milli); + if (lm95245_device) + lm95245_set_remote_os_limit(lm95245_device, hi_limit_milli); + return 0; } -static int lm95245_set_alert(void *_data, - void (*alert_func)(void *), - void *alert_data) +static int lm95245_set_alert(void *_data, void (*alert_func)(void *), + void *alert_data) { lm95245_device = _data; apalis_t30_alert_func = alert_func; apalis_t30_alert_data = alert_data; + return 0; } static int lm95245_set_shutdown_temp(void *_data, long shutdown_temp) { struct device *lm95245_device = _data; - if (lm95245_device) lm95245_set_remote_critical_limit(lm95245_device, - shutdown_temp); + + if (lm95245_device) + lm95245_set_remote_critical_limit(lm95245_device, + shutdown_temp); + return 0; } @@ -1128,8 +1139,10 @@ static int lm95245_get_itemp(void *dev_data, long *temp) { struct device *lm95245_device = dev_data; int lm95245_temp = 0; + lm95245_get_local_temp(lm95245_device, &lm95245_temp); *temp = lm95245_temp; + return 0; } #endif /* CONFIG_TEGRA_SKIN_THROTTLE */ @@ -1139,7 +1152,7 @@ static void lm95245_probe_callback(struct device *dev) struct tegra_thermal_device *lm95245_remote; lm95245_remote = kzalloc(sizeof(struct tegra_thermal_device), - GFP_KERNEL); + GFP_KERNEL); if (!lm95245_remote) { pr_err("unable to allocate thermal device\n"); return; @@ -1160,8 +1173,9 @@ static void lm95245_probe_callback(struct device *dev) #ifdef CONFIG_TEGRA_SKIN_THROTTLE { struct tegra_thermal_device *lm95245_local; + lm95245_local = kzalloc(sizeof(struct tegra_thermal_device), - GFP_KERNEL); + GFP_KERNEL); if (!lm95245_local) { kfree(lm95245_local); pr_err("unable to allocate thermal device\n"); @@ -1182,13 +1196,19 @@ static void lm95245_probe_callback(struct device *dev) pr_err("%s: unable to register THERMD_ALERT_N interrupt\n", __func__); - //initalize the local temp limit - if(dev) + /* initialise the local temp limit */ + if (dev) lm95245_set_local_shared_os__critical_limit(dev, TCRIT_LOCAL); } static void apalis_t30_thermd_alert_init(void) { + apalis_t30_low_edge = 0; + apalis_t30_low_hysteresis = 3000; + apalis_t30_low_limit = 0; + lm95245_device = NULL; + thermd_alert_irq_disabled = 0; + gpio_request(THERMD_ALERT_N, "THERMD_ALERT_N"); gpio_direction_input(THERMD_ALERT_N); @@ -1222,9 +1242,8 @@ static void __init uart_debug_init(void) int debug_port_id; debug_port_id = get_tegra_uart_debug_port_id(); - if (debug_port_id < 0) { + if (debug_port_id < 0) debug_port_id = 0; - } switch (debug_port_id) { case 0: @@ -1272,7 +1291,6 @@ static void __init uart_debug_init(void) debug_uarta_device.dev.platform_data))->mapbase; break; } - return; } static void __init apalis_t30_uart_init(void) @@ -1284,7 +1302,7 @@ static void __init apalis_t30_uart_init(void) c = tegra_get_clock_by_name(uart_parent_clk[i].name); if (IS_ERR_OR_NULL(c)) { pr_err("Not able to get the clock for %s\n", - uart_parent_clk[i].name); + uart_parent_clk[i].name); continue; } uart_parent_clk[i].parent_clk = c; @@ -1303,7 +1321,7 @@ static void __init apalis_t30_uart_init(void) /* Clock enable for the debug channel */ if (!IS_ERR_OR_NULL(debug_uart_clk)) { pr_info("The debug console clock name is %s\n", - debug_uart_clk->name); + debug_uart_clk->name); c = tegra_get_clock_by_name("pll_p"); if (IS_ERR_OR_NULL(c)) pr_err("Not getting the parent clock pll_p\n"); @@ -1314,12 +1332,12 @@ static void __init apalis_t30_uart_init(void) clk_set_rate(debug_uart_clk, clk_get_rate(c)); } else { pr_err("Not getting the clock %s for debug console\n", - debug_uart_clk->name); + debug_uart_clk->name); } } platform_add_devices(apalis_t30_uart_devices, - ARRAY_SIZE(apalis_t30_uart_devices)); + ARRAY_SIZE(apalis_t30_uart_devices)); } /* USB */ @@ -1458,19 +1476,18 @@ static void apalis_t30_usb_init(void) #ifdef CONFIG_W1_MASTER_TEGRA struct tegra_w1_timings apalis_t30_w1_timings = { - .tsu = 1, - .trelease = 0xf, - .trdv = 0xf, + .psclk = 0x50, + .rdsclk = 0x7, .tlow0 = 0x3c, .tlow1 = 1, - .tslot = 0x77, - - .tpdl = 0x78, .tpdh = 0x1e, - .trstl = 0x1df, + .tpdl = 0x78, + .trdv = 0xf, + .trelease = 0xf, .trsth = 0x1df, - .rdsclk = 0x7, - .psclk = 0x50, + .trstl = 0x1df, + .tslot = 0x77, + .tsu = 1, }; struct tegra_w1_platform_data apalis_t30_w1_platform_data = { @@ -1516,9 +1533,6 @@ static struct platform_device *apalis_t30_devices[] __initdata = { &apalis_t30_audio_sgtl5000_device, &tegra_hda_device, &tegra_cec_device, -#ifdef CONFIG_KEYBOARD_GPIO -// &apalis_t30_keys_device, -#endif &tegra_led_pwm_device, &tegra_pwfm1_device, &tegra_pwfm2_device, @@ -1530,9 +1544,8 @@ static struct platform_device *apalis_t30_devices[] __initdata = { static void __init apalis_t30_init(void) { - tegra_thermal_init(&thermal_data, - throttle_list, - ARRAY_SIZE(throttle_list)); + tegra_thermal_init(&thermal_data, throttle_list, + ARRAY_SIZE(throttle_list)); tegra_clk_init_from_table(apalis_t30_clk_init_table); apalis_t30_pinmux_init(); apalis_t30_thermd_alert_init(); @@ -1546,37 +1559,40 @@ static void __init apalis_t30_init(void) #ifdef CONFIG_W1_MASTER_TEGRA tegra_w1_device.dev.platform_data = &apalis_t30_w1_platform_data; #endif - platform_add_devices(apalis_t30_devices, ARRAY_SIZE(apalis_t30_devices) - ); + platform_add_devices(apalis_t30_devices, + ARRAY_SIZE(apalis_t30_devices)); tegra_ram_console_debug_init(); tegra_io_dpd_init(); apalis_t30_sdhci_init(); apalis_t30_regulator_init(); apalis_t30_suspend_init(); apalis_t30_panel_init(); -// apalis_t30_sensors_init(); apalis_t30_sata_init(); apalis_t30_emc_init(); apalis_t30_register_spidev(); #if defined(CONFIG_VIDEO_TEGRA) || defined(CONFIG_VIDEO_TEGRA_MODULE) -#if defined(CONFIG_SOC_CAMERA_MAX9526) || defined(CONFIG_SOC_CAMERA_MAX9526_MODULE) - platform_device_register(&soc_camera_max9526); -#endif #if defined(CONFIG_VIDEO_ADV7180) || defined(CONFIG_VIDEO_ADV7180_MODULE) platform_device_register(&soc_camera_adv7180); #endif #if defined(CONFIG_VIDEO_ADV7280) || defined(CONFIG_VIDEO_ADV7280_MODULE) platform_device_register(&soc_camera_adv7280); #endif -#if defined(CONFIG_SOC_CAMERA_TVP5150) || defined(CONFIG_SOC_CAMERA_TVP5150_MODULE) - platform_device_register(&soc_camera_tvp5150soc); +#if defined(CONFIG_SOC_CAMERA_AS0260) || \ + defined(CONFIG_SOC_CAMERA_AS0260_MODULE) + platform_device_register(&soc_camera_as0260soc); #endif -#if defined(CONFIG_SOC_CAMERA_OV7670SOC) || defined(CONFIG_SOC_CAMERA_OV7670SOC_MODULE) +#if defined(CONFIG_SOC_CAMERA_MAX9526) || \ + defined(CONFIG_SOC_CAMERA_MAX9526_MODULE) + platform_device_register(&soc_camera_max9526); +#endif +#if defined(CONFIG_SOC_CAMERA_OV7670SOC) || \ + defined(CONFIG_SOC_CAMERA_OV7670SOC_MODULE) platform_device_register(&soc_camera_ov7670soc); #endif -#if defined(CONFIG_SOC_CAMERA_AS0260) || defined(CONFIG_SOC_CAMERA_AS0260_MODULE) - platform_device_register(&soc_camera_as0260soc); +#if defined(CONFIG_SOC_CAMERA_TVP5150) || \ + defined(CONFIG_SOC_CAMERA_TVP5150_MODULE) + platform_device_register(&soc_camera_tvp5150soc); #endif #endif /* CONFIG_VIDEO_TEGRA | CONFIG_VIDEO_TEGRA_MODULE */ -- cgit v1.2.3