Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Common code for Palm LD, T5, TX, Z72
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (C) 2010-2011 Marek Vasut <marek.vasut@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/gpio_keys.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/pda_power.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/pwm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/pwm_backlight.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/gpio/machine.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/wm97xx.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/power_supply.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <linux/regulator/max1586.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <linux/platform_data/i2c-pxa.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include <asm/mach/arch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include <asm/mach/map.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include "pxa27x.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include <mach/audio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #include <linux/platform_data/mmc-pxamci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #include <linux/platform_data/video-pxafb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #include <linux/platform_data/irda-pxaficp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #include "udc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include <linux/platform_data/asoc-palm27x.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #include "palm27x.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #include "generic.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #include "devices.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  * SD/MMC card controller
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) static struct pxamci_platform_data palm27x_mci_platform_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	.ocr_mask		= MMC_VDD_32_33 | MMC_VDD_33_34,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	.detect_delay_ms	= 200,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) void __init palm27x_mmc_init(struct gpiod_lookup_table *gtable)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	if (gtable)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 		gpiod_add_lookup_table(gtable);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	pxa_set_mci_info(&palm27x_mci_platform_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)  * Power management - standby
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) #if defined(CONFIG_SUSPEND)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) void __init palm27x_pm_init(unsigned long str_base)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	static const unsigned long resume[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 		0xe3a00101,	/* mov	r0,	#0x40000000 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 		0xe380060f,	/* orr	r0, r0, #0x00f00000 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 		0xe590f008,	/* ldr	pc, [r0, #0x08] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	 * Copy the bootloader.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	 * NOTE: PalmZ72 uses a different wakeup method!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	memcpy(phys_to_virt(str_base), resume, sizeof(resume));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77)  * Framebuffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) struct pxafb_mode_info palm_320x480_lcd_mode = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	.pixclock	= 57692,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	.xres		= 320,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	.yres		= 480,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	.bpp		= 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	.left_margin	= 32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	.right_margin	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	.upper_margin	= 7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	.lower_margin	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	.hsync_len	= 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	.vsync_len	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) struct pxafb_mode_info palm_320x320_lcd_mode = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	.pixclock	= 115384,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	.xres		= 320,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	.yres		= 320,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	.bpp		= 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	.left_margin	= 27,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	.right_margin	= 7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	.upper_margin	= 7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	.lower_margin	= 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	.hsync_len	= 6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	.vsync_len	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) struct pxafb_mode_info palm_320x320_new_lcd_mode = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	.pixclock	= 86538,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	.xres		= 320,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	.yres		= 320,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	.bpp		= 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	.left_margin	= 20,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	.right_margin	= 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	.upper_margin	= 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	.lower_margin	= 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	.hsync_len	= 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	.vsync_len	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) static struct pxafb_mach_info palm27x_lcd_screen = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	.num_modes	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	.lcd_conn	= LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) static int palm27x_lcd_power;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) static void palm27x_lcd_ctl(int on, struct fb_var_screeninfo *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	gpio_set_value(palm27x_lcd_power, on);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) void __init palm27x_lcd_init(int power, struct pxafb_mode_info *mode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	palm27x_lcd_screen.modes = mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	if (gpio_is_valid(power)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 		if (!gpio_request(power, "LCD power")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 			pr_err("Palm27x: failed to claim lcd power gpio!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 			return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 		if (!gpio_direction_output(power, 1)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 			pr_err("Palm27x: lcd power configuration failed!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 			return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 		palm27x_lcd_power = power;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 		palm27x_lcd_screen.pxafb_lcd_power = palm27x_lcd_ctl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	pxa_set_fb_info(NULL, &palm27x_lcd_screen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)  * USB Gadget
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) #if	defined(CONFIG_USB_PXA27X) || \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	defined(CONFIG_USB_PXA27X_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) /* The actual GPIO offsets get filled in in the palm27x_udc_init() call */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) static struct gpiod_lookup_table palm27x_udc_gpiod_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	.dev_id = "gpio-vbus",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	.table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 		GPIO_LOOKUP("gpio-pxa", 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 			    "vbus", GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 		GPIO_LOOKUP("gpio-pxa", 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 			    "pullup", GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 		{ },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) static struct platform_device palm27x_gpio_vbus = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	.name	= "gpio-vbus",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	.id	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) void __init palm27x_udc_init(int vbus, int pullup, int vbus_inverted)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	palm27x_udc_gpiod_table.table[0].chip_hwnum = vbus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	palm27x_udc_gpiod_table.table[1].chip_hwnum = pullup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	if (vbus_inverted)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 		palm27x_udc_gpiod_table.table[0].flags = GPIO_ACTIVE_LOW;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	gpiod_add_lookup_table(&palm27x_udc_gpiod_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	platform_device_register(&palm27x_gpio_vbus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)  * IrDA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) #if defined(CONFIG_IRDA) || defined(CONFIG_IRDA_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) static struct pxaficp_platform_data palm27x_ficp_platform_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	.transceiver_cap	= IR_SIRMODE | IR_OFF,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) void __init palm27x_irda_init(int pwdn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	palm27x_ficp_platform_data.gpio_pwdown = pwdn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	pxa_set_ficp_info(&palm27x_ficp_platform_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)  * WM97xx audio, battery
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) #if	defined(CONFIG_TOUCHSCREEN_WM97XX) || \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	defined(CONFIG_TOUCHSCREEN_WM97XX_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) static struct wm97xx_batt_pdata palm27x_batt_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	.batt_aux	= WM97XX_AUX_ID3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	.temp_aux	= WM97XX_AUX_ID2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	.charge_gpio	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	.batt_mult	= 1000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	.batt_div	= 414,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	.temp_mult	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	.temp_div	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	.batt_tech	= POWER_SUPPLY_TECHNOLOGY_LIPO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	.batt_name	= "main-batt",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) static struct wm97xx_pdata palm27x_wm97xx_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	.batt_pdata	= &palm27x_batt_pdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) static pxa2xx_audio_ops_t palm27x_ac97_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	.codec_pdata	= { &palm27x_wm97xx_pdata, },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) static struct palm27x_asoc_info palm27x_asoc_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	.jack_gpio	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) static struct platform_device palm27x_asoc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	.name = "palm27x-asoc",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	.id   = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	.dev  = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 		.platform_data = &palm27x_asoc_pdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) void __init palm27x_ac97_init(int minv, int maxv, int jack, int reset)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	palm27x_ac97_pdata.reset_gpio	= reset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	palm27x_asoc_pdata.jack_gpio	= jack;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	if (minv < 0 || maxv < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 		palm27x_ac97_pdata.codec_pdata[0] = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 		pxa_set_ac97_info(&palm27x_ac97_pdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 		palm27x_batt_pdata.min_voltage	= minv,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 		palm27x_batt_pdata.max_voltage	= maxv,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 		pxa_set_ac97_info(&palm27x_ac97_pdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 		platform_device_register(&palm27x_asoc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)  * Backlight
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) static struct pwm_lookup palm27x_pwm_lookup[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.0", NULL, 3500 * 1024,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 		   PWM_POLARITY_NORMAL),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) static int palm_bl_power;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) static int palm_lcd_power;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) static int palm27x_backlight_init(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 	ret = gpio_request(palm_bl_power, "BL POWER");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 		goto err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	ret = gpio_direction_output(palm_bl_power, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 		goto err2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 	if (gpio_is_valid(palm_lcd_power)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 		ret = gpio_request(palm_lcd_power, "LCD POWER");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 			goto err2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 		ret = gpio_direction_output(palm_lcd_power, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 			goto err3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) err3:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	gpio_free(palm_lcd_power);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) err2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 	gpio_free(palm_bl_power);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) err:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) static int palm27x_backlight_notify(struct device *dev, int brightness)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 	gpio_set_value(palm_bl_power, brightness);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 	if (gpio_is_valid(palm_lcd_power))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 		gpio_set_value(palm_lcd_power, brightness);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 	return brightness;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) static void palm27x_backlight_exit(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 	gpio_free(palm_bl_power);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 	if (gpio_is_valid(palm_lcd_power))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 		gpio_free(palm_lcd_power);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) static struct platform_pwm_backlight_data palm27x_backlight_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 	.max_brightness	= 0xfe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 	.dft_brightness	= 0x7e,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 	.init		= palm27x_backlight_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 	.notify		= palm27x_backlight_notify,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 	.exit		= palm27x_backlight_exit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) static struct platform_device palm27x_backlight = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 	.name	= "pwm-backlight",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 	.dev	= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 		.parent		= &pxa27x_device_pwm0.dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 		.platform_data	= &palm27x_backlight_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) void __init palm27x_pwm_init(int bl, int lcd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 	palm_bl_power	= bl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 	palm_lcd_power	= lcd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 	pwm_add_table(palm27x_pwm_lookup, ARRAY_SIZE(palm27x_pwm_lookup));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 	platform_device_register(&palm27x_backlight);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344)  * Power supply
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) #if defined(CONFIG_PDA_POWER) || defined(CONFIG_PDA_POWER_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) static int palm_ac_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) static int palm_usb_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) static int palm27x_power_supply_init(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 	ret = gpio_request(palm_ac_state, "AC state");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 		goto err1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 	ret = gpio_direction_input(palm_ac_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 		goto err2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 	if (gpio_is_valid(palm_usb_state)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 		ret = gpio_request(palm_usb_state, "USB state");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 			goto err2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 		ret = gpio_direction_input(palm_usb_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 			goto err3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) err3:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 	gpio_free(palm_usb_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) err2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 	gpio_free(palm_ac_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) err1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) static void palm27x_power_supply_exit(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 	gpio_free(palm_usb_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 	gpio_free(palm_ac_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) static int palm27x_is_ac_online(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 	return gpio_get_value(palm_ac_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) static int palm27x_is_usb_online(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 	return !gpio_get_value(palm_usb_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) static char *palm27x_supplicants[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 	"main-battery",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) static struct pda_power_pdata palm27x_ps_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 	.init			= palm27x_power_supply_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 	.exit			= palm27x_power_supply_exit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 	.is_ac_online		= palm27x_is_ac_online,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 	.is_usb_online		= palm27x_is_usb_online,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 	.supplied_to		= palm27x_supplicants,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 	.num_supplicants	= ARRAY_SIZE(palm27x_supplicants),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) static struct platform_device palm27x_power_supply = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 	.name = "pda-power",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 	.id   = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 	.dev  = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 		.platform_data = &palm27x_ps_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) void __init palm27x_power_init(int ac, int usb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 	palm_ac_state	= ac;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 	palm_usb_state	= usb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 	platform_device_register(&palm27x_power_supply);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)  * Core power regulator
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) #if defined(CONFIG_REGULATOR_MAX1586) || \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)     defined(CONFIG_REGULATOR_MAX1586_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) static struct regulator_consumer_supply palm27x_max1587a_consumers[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) 	REGULATOR_SUPPLY("vcc_core", NULL),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) static struct regulator_init_data palm27x_max1587a_v3_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 	.constraints = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) 		.name		= "vcc_core range",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 		.min_uV		= 900000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) 		.max_uV		= 1705000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) 		.always_on	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 		.valid_ops_mask	= REGULATOR_CHANGE_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) 	.consumer_supplies	= palm27x_max1587a_consumers,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) 	.num_consumer_supplies	= ARRAY_SIZE(palm27x_max1587a_consumers),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) static struct max1586_subdev_data palm27x_max1587a_subdevs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 		.name		= "vcc_core",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) 		.id		= MAX1586_V3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) 		.platform_data	= &palm27x_max1587a_v3_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) static struct max1586_platform_data palm27x_max1587a_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) 	.subdevs     = palm27x_max1587a_subdevs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) 	.num_subdevs = ARRAY_SIZE(palm27x_max1587a_subdevs),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) 	.v3_gain     = MAX1586_GAIN_R24_3k32, /* 730..1550 mV */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) static struct i2c_board_info __initdata palm27x_pi2c_board_info[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) 		I2C_BOARD_INFO("max1586", 0x14),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) 		.platform_data	= &palm27x_max1587a_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) static struct i2c_pxa_platform_data palm27x_i2c_power_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) 	.use_pio	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) void __init palm27x_pmic_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) 	i2c_register_board_info(1, ARRAY_AND_SIZE(palm27x_pi2c_board_info));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) 	pxa27x_set_i2c_power_info(&palm27x_i2c_power_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) #endif