-1
};
-static void da850_panel_power_ctrl(int val)
-{
- /* lcd power */
- gpio_set_value(DA850_LCD_PWR_PIN, val);
-}
-
static struct property_entry da850_lcd_backlight_props[] = {
PROPERTY_ENTRY_BOOL("default-on"),
{ }
.properties = da850_lcd_backlight_props,
};
+static struct regulator_consumer_supply da850_lcd_supplies[] = {
+ REGULATOR_SUPPLY("lcd", NULL),
+};
+
+static struct regulator_init_data da850_lcd_supply_data = {
+ .consumer_supplies = da850_lcd_supplies,
+ .num_consumer_supplies = ARRAY_SIZE(da850_lcd_supplies),
+ .constraints = {
+ .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+ },
+};
+
+static struct fixed_voltage_config da850_lcd_supply = {
+ .supply_name = "lcd",
+ .microvolts = 33000000,
+ .init_data = &da850_lcd_supply_data,
+};
+
+static struct platform_device da850_lcd_supply_device = {
+ .name = "reg-fixed-voltage",
+ .id = 1, /* Dummy fixed regulator is 0 */
+ .dev = {
+ .platform_data = &da850_lcd_supply,
+ },
+};
+
+static struct gpiod_lookup_table da850_lcd_supply_gpio_table = {
+ .dev_id = "reg-fixed-voltage.1",
+ .table = {
+ GPIO_LOOKUP("davinci_gpio", DA850_LCD_PWR_PIN, NULL, 0),
+ { }
+ },
+};
+
+static struct gpiod_lookup_table *da850_lcd_gpio_lookups[] = {
+ &da850_lcd_backlight_gpio_table,
+ &da850_lcd_supply_gpio_table,
+};
+
static int da850_lcd_hw_init(void)
{
struct platform_device *backlight;
int status;
- gpiod_add_lookup_table(&da850_lcd_backlight_gpio_table);
+ gpiod_add_lookup_tables(da850_lcd_gpio_lookups,
+ ARRAY_SIZE(da850_lcd_gpio_lookups));
+
backlight = platform_device_register_full(&da850_lcd_backlight_info);
if (IS_ERR(backlight))
return PTR_ERR(backlight);
- status = gpio_request(DA850_LCD_PWR_PIN, "lcd pwr");
- if (status < 0)
+ status = platform_device_register(&da850_lcd_supply_device);
+ if (status)
return status;
- gpio_direction_output(DA850_LCD_PWR_PIN, 0);
-
- /* Switch off panel power */
- da850_panel_power_ctrl(0);
-
- /* Switch on panel power */
- da850_panel_power_ctrl(1);
-
return 0;
}
if (ret)
pr_warn("%s: LCD initialization failed: %d\n", __func__, ret);
- sharp_lk043t1dg01_pdata.panel_power_ctrl = da850_panel_power_ctrl,
ret = da8xx_register_lcdc(&sharp_lk043t1dg01_pdata);
if (ret)
pr_warn("%s: LCDC registration failed: %d\n", __func__, ret);