cregit-Linux how code gets into the kernel

Release 4.11 arch/arm/mach-pxa/palmz72.c

/*
 * Hardware definitions for Palm Zire72
 *
 * Authors:
 *      Vladimir "Farcaller" Pouzanov <farcaller@gmail.com>
 *      Sergey Lapin <slapin@ossfans.org>
 *      Alex Osborne <bobofdoom@gmail.com>
 *      Jan Herman <2hp@seznam.cz>
 *
 * Rewrite for mainline:
 *      Marek Vasut <marek.vasut@gmail.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.
 *
 * (find more info at www.hackndev.com)
 *
 */

#include <linux/platform_device.h>
#include <linux/syscore_ops.h>
#include <linux/delay.h>
#include <linux/irq.h>
#include <linux/gpio_keys.h>
#include <linux/input.h>
#include <linux/pda_power.h>
#include <linux/pwm_backlight.h>
#include <linux/gpio.h>
#include <linux/wm97xx.h>
#include <linux/power_supply.h>
#include <linux/usb/gpio_vbus.h>
#include <linux/i2c-gpio.h>

#include <asm/mach-types.h>
#include <asm/suspend.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>

#include "pxa27x.h"
#include <mach/audio.h>
#include "palmz72.h"
#include <linux/platform_data/mmc-pxamci.h>
#include <linux/platform_data/video-pxafb.h>
#include <linux/platform_data/irda-pxaficp.h>
#include <linux/platform_data/keypad-pxa27x.h>
#include "udc.h"
#include <linux/platform_data/asoc-palm27x.h>
#include "palm27x.h"

#include "pm.h"
#include <linux/platform_data/media/camera-pxa.h>

#include <media/soc_camera.h>

#include "generic.h"
#include "devices.h"

/******************************************************************************
 * Pin configuration
 ******************************************************************************/

static unsigned long palmz72_pin_config[] __initdata = {
	/* MMC */
	GPIO32_MMC_CLK,
	GPIO92_MMC_DAT_0,
	GPIO109_MMC_DAT_1,
	GPIO110_MMC_DAT_2,
	GPIO111_MMC_DAT_3,
	GPIO112_MMC_CMD,
	GPIO14_GPIO,	/* SD detect */
	GPIO115_GPIO,	/* SD RO */
	GPIO98_GPIO,	/* SD power */

	/* AC97 */
	GPIO28_AC97_BITCLK,
	GPIO29_AC97_SDATA_IN_0,
	GPIO30_AC97_SDATA_OUT,
	GPIO31_AC97_SYNC,
	GPIO89_AC97_SYSCLK,
	GPIO113_AC97_nRESET,

	/* IrDA */
	GPIO49_GPIO,	/* ir disable */
	GPIO46_FICP_RXD,
	GPIO47_FICP_TXD,

	/* PWM */
	GPIO16_PWM0_OUT,

	/* USB */
	GPIO15_GPIO,	/* usb detect */
	GPIO95_GPIO,	/* usb pullup */

	/* Matrix keypad */
	GPIO100_KP_MKIN_0	| WAKEUP_ON_LEVEL_HIGH,
	GPIO101_KP_MKIN_1	| WAKEUP_ON_LEVEL_HIGH,
	GPIO102_KP_MKIN_2	| WAKEUP_ON_LEVEL_HIGH,
	GPIO97_KP_MKIN_3	| WAKEUP_ON_LEVEL_HIGH,
	GPIO103_KP_MKOUT_0,
	GPIO104_KP_MKOUT_1,
	GPIO105_KP_MKOUT_2,

	/* LCD */
	GPIOxx_LCD_TFT_16BPP,

	GPIO20_GPIO,	/* bl power */
	GPIO21_GPIO,	/* LCD border switch */
	GPIO22_GPIO,	/* LCD border color */
	GPIO96_GPIO,	/* lcd power */

	/* PXA Camera */
	GPIO81_CIF_DD_0,
	GPIO48_CIF_DD_5,
	GPIO50_CIF_DD_3,
	GPIO51_CIF_DD_2,
	GPIO52_CIF_DD_4,
	GPIO53_CIF_MCLK,
	GPIO54_CIF_PCLK,
	GPIO55_CIF_DD_1,
	GPIO84_CIF_FV,
	GPIO85_CIF_LV,
	GPIO93_CIF_DD_6,
	GPIO108_CIF_DD_7,

	GPIO56_GPIO,	/* OV9640 Powerdown */
	GPIO57_GPIO,	/* OV9640 Reset */
	GPIO91_GPIO,	/* OV9640 Power */

	/* I2C */
	GPIO117_GPIO,	/* I2C_SCL */
	GPIO118_GPIO,	/* I2C_SDA */

	/* Misc. */
	GPIO0_GPIO	| WAKEUP_ON_LEVEL_HIGH,	/* power detect */
	GPIO88_GPIO,				/* green led */
	GPIO27_GPIO,				/* WM9712 IRQ */
};

/******************************************************************************
 * GPIO keyboard
 ******************************************************************************/
#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)

static const unsigned int palmz72_matrix_keys[] = {
	KEY(0, 0, KEY_POWER),
	KEY(0, 1, KEY_F1),
	KEY(0, 2, KEY_ENTER),

	KEY(1, 0, KEY_F2),
	KEY(1, 1, KEY_F3),
	KEY(1, 2, KEY_F4),

	KEY(2, 0, KEY_UP),
	KEY(2, 2, KEY_DOWN),

	KEY(3, 0, KEY_RIGHT),
	KEY(3, 2, KEY_LEFT),
};


static struct matrix_keymap_data almz72_matrix_keymap_data = {
	.keymap			= palmz72_matrix_keys,
	.keymap_size		= ARRAY_SIZE(palmz72_matrix_keys),
};


static struct pxa27x_keypad_platform_data palmz72_keypad_platform_data = {
	.matrix_key_rows	= 4,
	.matrix_key_cols	= 3,
	.matrix_keymap_data	= &almz72_matrix_keymap_data,

	.debounce_interval	= 30,
};


static void __init palmz72_kpc_init(void) { pxa_set_keypad_info(&palmz72_keypad_platform_data); }

Contributors

PersonTokensPropCommitsCommitProp
Sergey Lapin853.33%150.00%
Marek Vašut746.67%150.00%
Total15100.00%2100.00%

#else
static inline void palmz72_kpc_init(void) {}

Contributors

PersonTokensPropCommitsCommitProp
Marek Vašut450.00%150.00%
Sergey Lapin450.00%150.00%
Total8100.00%2100.00%

#endif /****************************************************************************** * LEDs ******************************************************************************/ #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) static struct gpio_led gpio_leds[] = { { .name = "palmz72:green:led", .default_trigger = "none", .gpio = GPIO_NR_PALMZ72_LED_GREEN, }, }; static struct gpio_led_platform_data gpio_led_info = { .leds = gpio_leds, .num_leds = ARRAY_SIZE(gpio_leds), }; static struct platform_device palmz72_leds = { .name = "leds-gpio", .id = -1, .dev = { .platform_data = &gpio_led_info, } };
static void __init palmz72_leds_init(void) { platform_device_register(&palmz72_leds); }

Contributors

PersonTokensPropCommitsCommitProp
Marek Vašut15100.00%2100.00%
Total15100.00%2100.00%

#else
static inline void palmz72_leds_init(void) {}

Contributors

PersonTokensPropCommitsCommitProp
Sergey Lapin450.00%133.33%
Marek Vašut450.00%266.67%
Total8100.00%3100.00%

#endif #ifdef CONFIG_PM /* We have some black magic here * PalmOS ROM on recover expects special struct physical address * to be transferred via PSPR. Using this struct PalmOS restores * its state after sleep. As for Linux, we need to setup it the * same way. More than that, PalmOS ROM changes some values in memory. * For now only one location is found, which needs special treatment. * Thanks to Alex Osborne, Andrzej Zaborowski, and lots of other people * for reading backtraces for me :) */ #define PALMZ72_SAVE_DWORD ((unsigned long *)0xc0000050) static struct palmz72_resume_info palmz72_resume_info = { .magic0 = 0xb4e6, .magic1 = 1, /* reset state, MMU off etc */ .arm_control = 0, .aux_control = 0, .ttb = 0, .domain_access = 0, .process_id = 0, }; static unsigned long store_ptr; /* syscore_ops for Palm Zire 72 PM */
static int palmz72_pm_suspend(void) { /* setup the resume_info struct for the original bootloader */ palmz72_resume_info.resume_addr = (u32) cpu_resume; /* Storing memory touched by ROM */ store_ptr = *PALMZ72_SAVE_DWORD; /* Setting PSPR to a proper value */ PSPR = __pa_symbol(&palmz72_resume_info); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Sergey Lapin3391.67%125.00%
Rafael J. Wysocki12.78%125.00%
Florian Fainelli12.78%125.00%
Russell King12.78%125.00%
Total36100.00%4100.00%


static void palmz72_pm_resume(void) { *PALMZ72_SAVE_DWORD = store_ptr; }

Contributors

PersonTokensPropCommitsCommitProp
Sergey Lapin1184.62%150.00%
Rafael J. Wysocki215.38%150.00%
Total13100.00%2100.00%

static struct syscore_ops palmz72_pm_syscore_ops = { .suspend = palmz72_pm_suspend, .resume = palmz72_pm_resume, };
static int __init palmz72_pm_init(void) { if (machine_is_palmz72()) { register_syscore_ops(&palmz72_pm_syscore_ops); return 0; } return -ENODEV; }

Contributors

PersonTokensPropCommitsCommitProp
Sergey Lapin2379.31%150.00%
Rafael J. Wysocki620.69%150.00%
Total29100.00%2100.00%

device_initcall(palmz72_pm_init); #endif /****************************************************************************** * SoC Camera ******************************************************************************/ #if defined(CONFIG_SOC_CAMERA_OV9640) || \ defined(CONFIG_SOC_CAMERA_OV9640_MODULE) static struct pxacamera_platform_data palmz72_pxacamera_platform_data = { .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 | PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN, .mclk_10khz = 2600, }; /* Board I2C devices. */ static struct i2c_board_info palmz72_i2c_device[] = { { I2C_BOARD_INFO("ov9640", 0x30), } };
static int palmz72_camera_power(struct device *dev, int power) { gpio_set_value(GPIO_NR_PALMZ72_CAM_PWDN, !power); mdelay(50); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Marek Vašut30100.00%1100.00%
Total30100.00%1100.00%


static int palmz72_camera_reset(struct device *dev) { gpio_set_value(GPIO_NR_PALMZ72_CAM_RESET, 1); mdelay(50); gpio_set_value(GPIO_NR_PALMZ72_CAM_RESET, 0); mdelay(50); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Marek Vašut38100.00%1100.00%
Total38100.00%1100.00%

static struct soc_camera_link palmz72_iclink = { .bus_id = 0, /* Match id in pxa27x_device_camera in device.c */ .board_info = &palmz72_i2c_device[0], .i2c_adapter_id = 0, .module_name = "ov96xx", .power = &palmz72_camera_power, .reset = &palmz72_camera_reset, .flags = SOCAM_DATAWIDTH_8, }; static struct i2c_gpio_platform_data palmz72_i2c_bus_data = { .sda_pin = 118, .scl_pin = 117, .udelay = 10, .timeout = 100, }; static struct platform_device palmz72_i2c_bus_device = { .name = "i2c-gpio", .id = 0, /* we use this as a replacement for i2c-pxa */ .dev = { .platform_data = &palmz72_i2c_bus_data, } }; static struct platform_device palmz72_camera = { .name = "soc-camera-pdrv", .id = -1, .dev = { .platform_data = &palmz72_iclink, }, }; /* Here we request the camera GPIOs and configure them. We power up the camera * module, deassert the reset pin, but put it into powerdown (low to no power * consumption) mode. This allows us to later bring the module up fast. */ static struct gpio palmz72_camera_gpios[] = { { GPIO_NR_PALMZ72_CAM_POWER, GPIOF_INIT_HIGH,"Camera DVDD" }, { GPIO_NR_PALMZ72_CAM_RESET, GPIOF_INIT_LOW, "Camera RESET" }, { GPIO_NR_PALMZ72_CAM_PWDN, GPIOF_INIT_LOW, "Camera PWDN" }, };
static inline void __init palmz72_cam_gpio_init(void) { int ret; ret = gpio_request_array(ARRAY_AND_SIZE(palmz72_camera_gpios)); if (!ret) gpio_free_array(ARRAY_AND_SIZE(palmz72_camera_gpios)); else printk(KERN_ERR "Camera GPIO init failed!\n"); return; }

Contributors

PersonTokensPropCommitsCommitProp
Marek Vašut44100.00%1100.00%
Total44100.00%1100.00%


static void __init palmz72_camera_init(void) { palmz72_cam_gpio_init(); pxa_set_camera_info(&palmz72_pxacamera_platform_data); platform_device_register(&palmz72_i2c_bus_device); platform_device_register(&palmz72_camera); }

Contributors

PersonTokensPropCommitsCommitProp
Marek Vašut30100.00%1100.00%
Total30100.00%1100.00%

#else
static inline void palmz72_camera_init(void) {}

Contributors

PersonTokensPropCommitsCommitProp
Marek Vašut8100.00%1100.00%
Total8100.00%1100.00%

#endif /****************************************************************************** * Machine init ******************************************************************************/
static void __init palmz72_init(void) { pxa2xx_mfp_config(ARRAY_AND_SIZE(palmz72_pin_config)); pxa_set_ffuart_info(NULL); pxa_set_btuart_info(NULL); pxa_set_stuart_info(NULL); palm27x_mmc_init(GPIO_NR_PALMZ72_SD_DETECT_N, GPIO_NR_PALMZ72_SD_RO, GPIO_NR_PALMZ72_SD_POWER_N, 1); palm27x_lcd_init(-1, &palm_320x320_lcd_mode); palm27x_udc_init(GPIO_NR_PALMZ72_USB_DETECT_N, GPIO_NR_PALMZ72_USB_PULLUP, 0); palm27x_irda_init(GPIO_NR_PALMZ72_IR_DISABLE); palm27x_ac97_init(PALMZ72_BAT_MIN_VOLTAGE, PALMZ72_BAT_MAX_VOLTAGE, -1, 113); palm27x_pwm_init(-1, -1); palm27x_power_init(-1, -1); palm27x_pmic_init(); palmz72_kpc_init(); palmz72_leds_init(); palmz72_camera_init(); }

Contributors

PersonTokensPropCommitsCommitProp
Marek Vašut5550.93%250.00%
Sergey Lapin3835.19%125.00%
Russell King1513.89%125.00%
Total108100.00%4100.00%

MACHINE_START(PALMZ72, "Palm Zire72") .atag_offset = 0x100, .map_io = pxa27x_map_io, .nr_irqs = PXA_NR_IRQS, .init_irq = pxa27x_init_irq, .handle_irq = pxa27x_handle_irq, .init_time = pxa_timer_init, .init_machine = palmz72_init, .restart = pxa_restart, MACHINE_END

Overall Contributors

PersonTokensPropCommitsCommitProp
Sergey Lapin59648.03%28.70%
Marek Vašut55544.72%521.74%
Russell King252.01%417.39%
Chao Xie241.93%14.35%
Rafael J. Wysocki131.05%14.35%
Arnd Bergmann100.81%28.70%
Eric Miao70.56%313.04%
Rob Herring50.40%14.35%
Nico Pitre20.16%14.35%
Stephen Warren20.16%14.35%
Mauro Carvalho Chehab10.08%14.35%
Florian Fainelli10.08%14.35%
Total1241100.00%23100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.