staticstruct resource ams_delta_serio_resources[] = {
{
.flags = IORESOURCE_IRQ, /* * Initialize IRQ resource with invalid IRQ number. * It will be replaced with dynamically allocated GPIO IRQ * obtained from GPIO chip as soon as the chip is available.
*/
.start = -EINVAL,
.end = -EINVAL,
},
};
staticstruct platform_device ams_delta_serio_device = {
.name = "ams-delta-serio",
.id = PLATFORM_DEVID_NONE,
.dev = { /* * Initialize .platform_data explicitly with NULL to * indicate it is going to be used. It will be replaced * with FIQ buffer address as soon as FIQ is initialized.
*/
.platform_data = NULL,
},
.num_resources = ARRAY_SIZE(ams_delta_serio_resources),
.resource = ams_delta_serio_resources,
};
staticstruct regulator_consumer_supply keybrd_pwr_consumers[] = { /* * Initialize supply .dev_name with NULL. It will be replaced * with serio dev_name() as soon as the serio device is registered.
*/
REGULATOR_SUPPLY("vcc", NULL),
};
/* * Obtain MODEM IRQ GPIO descriptor using its hardware pin * number and assign related IRQ number to the MODEM port. * Keep the GPIO descriptor open so nobody steps in.
*/ staticvoid __init modem_assign_irq(struct gpio_chip *chip)
{ struct gpio_desc *gpiod;
/* * The purpose of this function is to take care of proper initialization of * devices and data structures which depend on GPIO lines provided by OMAP GPIO * banks but their drivers don't use GPIO lookup tables or GPIO layer at all. * The function may be called as soon as OMAP GPIO devices are probed. * Since that happens at postcore_initcall, it can be called successfully * from init_machine or later. * Dependent devices may be registered from within this function or later.
*/ staticvoid __init omap_gpio_deps_init(void)
{ struct gpio_device *gdev; struct gpio_chip *chip;
/* * Some drivers may not use GPIO lookup tables but need to be provided * with GPIO numbers. The same applies to GPIO based IRQ lines - some * drivers may even not use GPIO layer but expect just IRQ numbers. * We could either define GPIO lookup tables then use them on behalf * of those devices, or we can use GPIO driver level methods for * identification of GPIO and IRQ numbers. * * This reference will be leaked but that's alright as this device * never goes down.
*/
gdev = gpio_device_find_by_label(OMAP_GPIO_LABEL); if (!gdev) {
pr_err("%s: OMAP GPIO device not found\n", __func__); return;
}
chip = gpio_device_get_chip(gdev);
/* * Start with FIQ initialization as it may have to request * and release successfully each OMAP GPIO pin in turn.
*/
ams_delta_init_fiq(chip, &ams_delta_serio_device);
modem_assign_irq(chip);
}
/* * Initialize latch2 pins with values which are safe for dependent on-board * devices or useful for their successull initialization even before GPIO * driver takes control over the latch pins: * - LATCH2_PIN_LCD_VBLEN = 0 * - LATCH2_PIN_LCD_NDISP = 0 Keep LCD device powered off before its * driver takes control over it. * - LATCH2_PIN_NAND_NCE = 0 * - LATCH2_PIN_NAND_NWP = 0 Keep NAND device down and write- * protected before its driver takes * control over it. * - LATCH2_PIN_KEYBRD_PWR = 0 Keep keyboard powered off before serio * driver takes control over it. * - LATCH2_PIN_KEYBRD_DATAOUT = 0 Keep low to avoid corruption of first * byte of data received from attached * keyboard when serio device is probed; * the pin is also hogged low by the latch2 * GPIO driver as soon as it is ready. * - LATCH2_PIN_MODEM_NRESET = 1 Enable voice MODEM device, allowing for * its successful probe even before a * regulator it depends on, which in turn * takes control over the pin, is set up. * - LATCH2_PIN_MODEM_CODEC = 1 Attach voice MODEM CODEC data port * to the MODEM so the CODEC is under * control even if audio driver doesn't * take it over.
*/ staticvoid __init ams_delta_latch2_init(void)
{
u16 latch2 = 1 << LATCH2_PIN_MODEM_NRESET | 1 << LATCH2_PIN_MODEM_CODEC;
/* * As soon as regulator consumers have been registered, assign their * dev_names to consumer supply entries of respective regulators.
*/
keybrd_pwr_consumers[0].dev_name =
dev_name(&ams_delta_serio_device.dev);
/* * Once consumer supply entries are populated with dev_names, * register regulator devices. At this stage only the keyboard * power regulator has its consumer supply table fully populated.
*/
platform_device_register(&keybrd_pwr_device);
/* * As soon as GPIO consumers have been registered, assign * their dev_names to respective GPIO lookup tables.
*/
ams_delta_audio_gpio_table.dev_id =
dev_name(&ams_delta_audio_device.dev);
keybrd_pwr_gpio_table.dev_id = dev_name(&keybrd_pwr_device.dev);
ams_delta_nand_gpio_table.dev_id = dev_name(&ams_delta_nand_device.dev);
ams_delta_lcd_gpio_table.dev_id = dev_name(&ams_delta_lcd_device.dev);
/* * Once GPIO lookup tables are populated with dev_names, register them.
*/
gpiod_add_lookup_tables(ams_delta_gpio_tables,
ARRAY_SIZE(ams_delta_gpio_tables));
/* * This function expects MODEM IRQ number already assigned to the port. * The MODEM device requires its RESET# pin kept high during probe. * That requirement can be fulfilled in several ways: * - with a descriptor of already functional modem_nreset regulator * assigned to the MODEM private data, * - with the regulator not yet controlled by modem_pm function but * already enabled by default on probe, * - before the modem_nreset regulator is probed, with the pin already * set high explicitly. * The last one is already guaranteed by ams_delta_latch2_init() called * from machine_init. * In order to avoid taking over ttyS0 device slot, the MODEM device * should be registered after OMAP serial ports. Since those ports * are registered at arch_initcall, this function can be called safely * at arch_initcall_sync earliest.
*/ staticint __init ams_delta_modem_init(void)
{ if (!machine_is_ams_delta()) return -ENODEV;
omap_cfg_reg(M14_1510_GPIO2);
/* Initialize the modem_nreset regulator consumer before use */
modem_priv.regulator = ERR_PTR(-ENODEV);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.