Commit 1ad4fb2f authored by Olof Johansson's avatar Olof Johansson

Merge branch 'ams-delta' of...

Merge branch 'ams-delta' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into next/boards

* 'ams-delta' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
  ASoC: OMAP: ams-delta: drop .set_bias_level callback
  ARM: OMAP1: ams-delta: update the modem to use regulator API
  ARM: OMAP1: ams-delta: set up regulator over modem reset GPIO pin
  ARM: OMAP1: ams-delta: clean up init data section assignments
  ARM: OMAP1: ams-delta: fix incorrect section tags
parents 2eed4e7d 0379c1f5
...@@ -157,6 +157,8 @@ config MACH_AMS_DELTA ...@@ -157,6 +157,8 @@ config MACH_AMS_DELTA
select FIQ select FIQ
select GPIO_GENERIC_PLATFORM select GPIO_GENERIC_PLATFORM
select LEDS_GPIO_REGISTER select LEDS_GPIO_REGISTER
select REGULATOR
select REGULATOR_FIXED_VOLTAGE
help help
Support for the Amstrad E3 (codename Delta) videophone. Say Y here Support for the Amstrad E3 (codename Delta) videophone. Say Y here
if you have such a device. if you have such a device.
......
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
#include <linux/regulator/fixed.h>
#include <linux/regulator/machine.h>
#include <linux/serial_8250.h> #include <linux/serial_8250.h>
#include <linux/export.h> #include <linux/export.h>
...@@ -150,11 +153,11 @@ static struct map_desc ams_delta_io_desc[] __initdata = { ...@@ -150,11 +153,11 @@ static struct map_desc ams_delta_io_desc[] __initdata = {
} }
}; };
static struct omap_lcd_config ams_delta_lcd_config = { static struct omap_lcd_config ams_delta_lcd_config __initdata = {
.ctrl_name = "internal", .ctrl_name = "internal",
}; };
static struct omap_usb_config ams_delta_usb_config __initdata = { static struct omap_usb_config ams_delta_usb_config = {
.register_host = 1, .register_host = 1,
.hmc_mode = 16, .hmc_mode = 16,
.pins[0] = 2, .pins[0] = 2,
...@@ -167,7 +170,7 @@ static struct omap_board_config_kernel ams_delta_config[] __initdata = { ...@@ -167,7 +170,7 @@ static struct omap_board_config_kernel ams_delta_config[] __initdata = {
#define LATCH1_GPIO_BASE 232 #define LATCH1_GPIO_BASE 232
#define LATCH1_NGPIO 8 #define LATCH1_NGPIO 8
static struct resource latch1_resources[] __initconst = { static struct resource latch1_resources[] = {
[0] = { [0] = {
.name = "dat", .name = "dat",
.start = LATCH1_PHYS, .start = LATCH1_PHYS,
...@@ -176,7 +179,7 @@ static struct resource latch1_resources[] __initconst = { ...@@ -176,7 +179,7 @@ static struct resource latch1_resources[] __initconst = {
}, },
}; };
static struct bgpio_pdata latch1_pdata __initconst = { static struct bgpio_pdata latch1_pdata = {
.base = LATCH1_GPIO_BASE, .base = LATCH1_GPIO_BASE,
.ngpio = LATCH1_NGPIO, .ngpio = LATCH1_NGPIO,
}; };
...@@ -191,7 +194,7 @@ static struct platform_device latch1_gpio_device = { ...@@ -191,7 +194,7 @@ static struct platform_device latch1_gpio_device = {
}, },
}; };
static struct resource latch2_resources[] __initconst = { static struct resource latch2_resources[] = {
[0] = { [0] = {
.name = "dat", .name = "dat",
.start = LATCH2_PHYS, .start = LATCH2_PHYS,
...@@ -200,7 +203,7 @@ static struct resource latch2_resources[] __initconst = { ...@@ -200,7 +203,7 @@ static struct resource latch2_resources[] __initconst = {
}, },
}; };
static struct bgpio_pdata latch2_pdata __initconst = { static struct bgpio_pdata latch2_pdata = {
.base = AMS_DELTA_LATCH2_GPIO_BASE, .base = AMS_DELTA_LATCH2_GPIO_BASE,
.ngpio = AMS_DELTA_LATCH2_NGPIO, .ngpio = AMS_DELTA_LATCH2_NGPIO,
}; };
...@@ -215,7 +218,7 @@ static struct platform_device latch2_gpio_device = { ...@@ -215,7 +218,7 @@ static struct platform_device latch2_gpio_device = {
}, },
}; };
static struct gpio latch_gpios[] __initconst = { static const struct gpio latch_gpios[] __initconst = {
{ {
.gpio = LATCH1_GPIO_BASE + 6, .gpio = LATCH1_GPIO_BASE + 6,
.flags = GPIOF_OUT_INIT_LOW, .flags = GPIOF_OUT_INIT_LOW,
...@@ -236,11 +239,6 @@ static struct gpio latch_gpios[] __initconst = { ...@@ -236,11 +239,6 @@ static struct gpio latch_gpios[] __initconst = {
.flags = GPIOF_OUT_INIT_LOW, .flags = GPIOF_OUT_INIT_LOW,
.label = "scard_cmdvcc", .label = "scard_cmdvcc",
}, },
{
.gpio = AMS_DELTA_GPIO_PIN_MODEM_NRESET,
.flags = GPIOF_OUT_INIT_LOW,
.label = "modem_nreset",
},
{ {
.gpio = AMS_DELTA_GPIO_PIN_MODEM_CODEC, .gpio = AMS_DELTA_GPIO_PIN_MODEM_CODEC,
.flags = GPIOF_OUT_INIT_LOW, .flags = GPIOF_OUT_INIT_LOW,
...@@ -258,6 +256,44 @@ static struct gpio latch_gpios[] __initconst = { ...@@ -258,6 +256,44 @@ static struct gpio latch_gpios[] __initconst = {
}, },
}; };
static struct regulator_consumer_supply modem_nreset_consumers[] = {
REGULATOR_SUPPLY("RESET#", "serial8250.1"),
REGULATOR_SUPPLY("POR", "cx20442-codec"),
};
static struct regulator_init_data modem_nreset_data = {
.constraints = {
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
.boot_on = 1,
},
.num_consumer_supplies = ARRAY_SIZE(modem_nreset_consumers),
.consumer_supplies = modem_nreset_consumers,
};
static struct fixed_voltage_config modem_nreset_config = {
.supply_name = "modem_nreset",
.microvolts = 3300000,
.gpio = AMS_DELTA_GPIO_PIN_MODEM_NRESET,
.startup_delay = 25000,
.enable_high = 1,
.enabled_at_boot = 1,
.init_data = &modem_nreset_data,
};
static struct platform_device modem_nreset_device = {
.name = "reg-fixed-voltage",
.id = -1,
.dev = {
.platform_data = &modem_nreset_config,
},
};
struct modem_private_data {
struct regulator *regulator;
};
static struct modem_private_data modem_priv;
void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value) void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value)
{ {
int bit = 0; int bit = 0;
...@@ -266,7 +302,8 @@ void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value) ...@@ -266,7 +302,8 @@ void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value)
for (; bit < ngpio; bit++, bitpos = bitpos << 1) { for (; bit < ngpio; bit++, bitpos = bitpos << 1) {
if (!(mask & bitpos)) if (!(mask & bitpos))
continue; continue;
gpio_set_value(base + bit, (value & bitpos) != 0); else
gpio_set_value(base + bit, (value & bitpos) != 0);
} }
} }
EXPORT_SYMBOL(ams_delta_latch_write); EXPORT_SYMBOL(ams_delta_latch_write);
...@@ -300,7 +337,7 @@ static const struct matrix_keymap_data ams_delta_keymap_data = { ...@@ -300,7 +337,7 @@ static const struct matrix_keymap_data ams_delta_keymap_data = {
.keymap_size = ARRAY_SIZE(ams_delta_keymap), .keymap_size = ARRAY_SIZE(ams_delta_keymap),
}; };
static struct omap_kp_platform_data ams_delta_kp_data __initdata = { static struct omap_kp_platform_data ams_delta_kp_data = {
.rows = 8, .rows = 8,
.cols = 8, .cols = 8,
.keymap_data = &ams_delta_keymap_data, .keymap_data = &ams_delta_keymap_data,
...@@ -322,7 +359,7 @@ static struct platform_device ams_delta_lcd_device = { ...@@ -322,7 +359,7 @@ static struct platform_device ams_delta_lcd_device = {
.id = -1, .id = -1,
}; };
static struct gpio_led gpio_leds[] __initconst = { static const struct gpio_led gpio_leds[] __initconst = {
{ {
.name = "camera", .name = "camera",
.gpio = LATCH1_GPIO_BASE + 0, .gpio = LATCH1_GPIO_BASE + 0,
...@@ -358,7 +395,7 @@ static struct gpio_led gpio_leds[] __initconst = { ...@@ -358,7 +395,7 @@ static struct gpio_led gpio_leds[] __initconst = {
}, },
}; };
static struct gpio_led_platform_data leds_pdata __initconst = { static const struct gpio_led_platform_data leds_pdata __initconst = {
.leds = gpio_leds, .leds = gpio_leds,
.num_leds = ARRAY_SIZE(gpio_leds), .num_leds = ARRAY_SIZE(gpio_leds),
}; };
...@@ -415,7 +452,7 @@ static struct platform_device *ams_delta_devices[] __initdata = { ...@@ -415,7 +452,7 @@ static struct platform_device *ams_delta_devices[] __initdata = {
&ams_delta_camera_device, &ams_delta_camera_device,
}; };
static struct platform_device *late_devices[] __initconst = { static struct platform_device *late_devices[] __initdata = {
&ams_delta_nand_device, &ams_delta_nand_device,
&ams_delta_lcd_device, &ams_delta_lcd_device,
}; };
...@@ -459,6 +496,22 @@ static void __init ams_delta_init(void) ...@@ -459,6 +496,22 @@ static void __init ams_delta_init(void)
omap_writew(omap_readw(ARM_RSTCT1) | 0x0004, ARM_RSTCT1); omap_writew(omap_readw(ARM_RSTCT1) | 0x0004, ARM_RSTCT1);
} }
static void modem_pm(struct uart_port *port, unsigned int state, unsigned old)
{
struct modem_private_data *priv = port->private_data;
if (IS_ERR(priv->regulator))
return;
if (state == old)
return;
if (state == 0)
regulator_enable(priv->regulator);
else if (old == 0)
regulator_disable(priv->regulator);
}
static struct plat_serial8250_port ams_delta_modem_ports[] = { static struct plat_serial8250_port ams_delta_modem_ports[] = {
{ {
.membase = IOMEM(MODEM_VIRT), .membase = IOMEM(MODEM_VIRT),
...@@ -469,6 +522,8 @@ static struct plat_serial8250_port ams_delta_modem_ports[] = { ...@@ -469,6 +522,8 @@ static struct plat_serial8250_port ams_delta_modem_ports[] = {
.iotype = UPIO_MEM, .iotype = UPIO_MEM,
.regshift = 1, .regshift = 1,
.uartclk = BASE_BAUD * 16, .uartclk = BASE_BAUD * 16,
.pm = modem_pm,
.private_data = &modem_priv,
}, },
{ }, { },
}; };
...@@ -496,6 +551,12 @@ static int __init late_init(void) ...@@ -496,6 +551,12 @@ static int __init late_init(void)
platform_add_devices(late_devices, ARRAY_SIZE(late_devices)); platform_add_devices(late_devices, ARRAY_SIZE(late_devices));
err = platform_device_register(&modem_nreset_device);
if (err) {
pr_err("Couldn't register the modem regulator device\n");
return err;
}
omap_cfg_reg(M14_1510_GPIO2); omap_cfg_reg(M14_1510_GPIO2);
ams_delta_modem_ports[0].irq = ams_delta_modem_ports[0].irq =
gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ); gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
...@@ -507,15 +568,30 @@ static int __init late_init(void) ...@@ -507,15 +568,30 @@ static int __init late_init(void)
} }
gpio_direction_input(AMS_DELTA_GPIO_PIN_MODEM_IRQ); gpio_direction_input(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
ams_delta_latch2_write( /* Initialize the modem_nreset regulator consumer before use */
AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC, modem_priv.regulator = ERR_PTR(-ENODEV);
AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC);
ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC,
AMS_DELTA_LATCH2_MODEM_CODEC);
err = platform_device_register(&ams_delta_modem_device); err = platform_device_register(&ams_delta_modem_device);
if (err) if (err)
goto gpio_free; goto gpio_free;
/*
* Once the modem device is registered, the modem_nreset
* regulator can be requested on behalf of that device.
*/
modem_priv.regulator = regulator_get(&ams_delta_modem_device.dev,
"RESET#");
if (IS_ERR(modem_priv.regulator)) {
err = PTR_ERR(modem_priv.regulator);
goto unregister;
}
return 0; return 0;
unregister:
platform_device_unregister(&ams_delta_modem_device);
gpio_free: gpio_free:
gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ); gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
return err; return err;
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#define AMD_DELTA_LATCH2_SCARD_RSTIN 0x0400 #define AMD_DELTA_LATCH2_SCARD_RSTIN 0x0400
#define AMD_DELTA_LATCH2_SCARD_CMDVCC 0x0800 #define AMD_DELTA_LATCH2_SCARD_CMDVCC 0x0800
#define AMS_DELTA_LATCH2_MODEM_NRESET 0x1000
#define AMS_DELTA_LATCH2_MODEM_CODEC 0x2000 #define AMS_DELTA_LATCH2_MODEM_CODEC 0x2000
#define AMS_DELTA_GPIO_PIN_KEYBRD_DATA 0 #define AMS_DELTA_GPIO_PIN_KEYBRD_DATA 0
......
...@@ -103,7 +103,7 @@ static void ams_delta_serio_close(struct serio *serio) ...@@ -103,7 +103,7 @@ static void ams_delta_serio_close(struct serio *serio)
gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 0); gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 0);
} }
static struct gpio ams_delta_gpios[] __initconst_or_module = { static const struct gpio ams_delta_gpios[] __initconst_or_module = {
{ {
.gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATA, .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATA,
.flags = GPIOF_DIR_IN, .flags = GPIOF_DIR_IN,
......
...@@ -145,7 +145,7 @@ static int ams_delta_nand_ready(struct mtd_info *mtd) ...@@ -145,7 +145,7 @@ static int ams_delta_nand_ready(struct mtd_info *mtd)
return gpio_get_value(AMS_DELTA_GPIO_PIN_NAND_RB); return gpio_get_value(AMS_DELTA_GPIO_PIN_NAND_RB);
} }
static struct gpio _mandatory_gpio[] __initconst_or_module = { static const struct gpio _mandatory_gpio[] = {
{ {
.gpio = AMS_DELTA_GPIO_PIN_NAND_NCE, .gpio = AMS_DELTA_GPIO_PIN_NAND_NCE,
.flags = GPIOF_OUT_INIT_HIGH, .flags = GPIOF_OUT_INIT_HIGH,
......
...@@ -99,7 +99,7 @@ static struct lcd_ops ams_delta_lcd_ops = { ...@@ -99,7 +99,7 @@ static struct lcd_ops ams_delta_lcd_ops = {
/* omapfb panel section */ /* omapfb panel section */
static struct gpio _gpios[] __initconst_or_module = { static const struct gpio _gpios[] = {
{ {
.gpio = AMS_DELTA_GPIO_PIN_LCD_VBLEN, .gpio = AMS_DELTA_GPIO_PIN_LCD_VBLEN,
.flags = GPIOF_OUT_INIT_LOW, .flags = GPIOF_OUT_INIT_LOW,
......
...@@ -426,29 +426,6 @@ static struct snd_soc_ops ams_delta_ops = { ...@@ -426,29 +426,6 @@ static struct snd_soc_ops ams_delta_ops = {
}; };
/* Board specific codec bias level control */
static int ams_delta_set_bias_level(struct snd_soc_card *card,
struct snd_soc_dapm_context *dapm,
enum snd_soc_bias_level level)
{
switch (level) {
case SND_SOC_BIAS_ON:
case SND_SOC_BIAS_PREPARE:
case SND_SOC_BIAS_STANDBY:
if (card->dapm.bias_level == SND_SOC_BIAS_OFF)
ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET,
AMS_DELTA_LATCH2_MODEM_NRESET);
break;
case SND_SOC_BIAS_OFF:
if (card->dapm.bias_level != SND_SOC_BIAS_OFF)
ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET,
0);
}
card->dapm.bias_level = level;
return 0;
}
/* Digital mute implemented using modem/CPU multiplexer. /* Digital mute implemented using modem/CPU multiplexer.
* Shares hardware with codec config pulse generation */ * Shares hardware with codec config pulse generation */
static bool ams_delta_muted = 1; static bool ams_delta_muted = 1;
...@@ -512,9 +489,6 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd) ...@@ -512,9 +489,6 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
ams_delta_ops.shutdown = ams_delta_shutdown; ams_delta_ops.shutdown = ams_delta_shutdown;
} }
/* Set codec bias level */
ams_delta_set_bias_level(card, dapm, SND_SOC_BIAS_STANDBY);
/* Add hook switch - can be used to control the codec from userspace /* Add hook switch - can be used to control the codec from userspace
* even if line discipline fails */ * even if line discipline fails */
ret = snd_soc_jack_new(rtd->codec, "hook_switch", ret = snd_soc_jack_new(rtd->codec, "hook_switch",
...@@ -598,7 +572,6 @@ static struct snd_soc_card ams_delta_audio_card = { ...@@ -598,7 +572,6 @@ static struct snd_soc_card ams_delta_audio_card = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.dai_link = &ams_delta_dai_link, .dai_link = &ams_delta_dai_link,
.num_links = 1, .num_links = 1,
.set_bias_level = ams_delta_set_bias_level,
}; };
/* Module init/exit */ /* Module init/exit */
...@@ -647,11 +620,6 @@ static void __exit ams_delta_module_exit(void) ...@@ -647,11 +620,6 @@ static void __exit ams_delta_module_exit(void)
ARRAY_SIZE(ams_delta_hook_switch_gpios), ARRAY_SIZE(ams_delta_hook_switch_gpios),
ams_delta_hook_switch_gpios); ams_delta_hook_switch_gpios);
/* Keep modem power on */
ams_delta_set_bias_level(&ams_delta_audio_card,
&ams_delta_audio_card.rtd[0].codec->dapm,
SND_SOC_BIAS_STANDBY);
platform_device_unregister(cx20442_platform_device); platform_device_unregister(cx20442_platform_device);
platform_device_unregister(ams_delta_audio_platform_device); platform_device_unregister(ams_delta_audio_platform_device);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment