.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * ezx.c - Common code for the EZX platform. |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2005-2006 Harald Welte <laforge@openezx.org>, |
---|
5 | 6 | * 2007-2008 Daniel Ribeiro <drwyrm@gmail.com>, |
---|
6 | 7 | * 2007-2008 Stefan Schmidt <stefan@datenfreihafen.org> |
---|
7 | | - * |
---|
8 | | - * This program is free software; you can redistribute it and/or modify |
---|
9 | | - * it under the terms of the GNU General Public License version 2 as |
---|
10 | | - * published by the Free Software Foundation. |
---|
11 | | - * |
---|
12 | 8 | */ |
---|
13 | 9 | |
---|
14 | 10 | #include <linux/kernel.h> |
---|
.. | .. |
---|
21 | 17 | #include <linux/regulator/fixed.h> |
---|
22 | 18 | #include <linux/input.h> |
---|
23 | 19 | #include <linux/gpio.h> |
---|
| 20 | +#include <linux/gpio/machine.h> |
---|
24 | 21 | #include <linux/gpio_keys.h> |
---|
25 | 22 | #include <linux/leds-lp3944.h> |
---|
26 | 23 | #include <linux/platform_data/i2c-pxa.h> |
---|
.. | .. |
---|
58 | 55 | static struct platform_pwm_backlight_data ezx_backlight_data = { |
---|
59 | 56 | .max_brightness = 1023, |
---|
60 | 57 | .dft_brightness = 1023, |
---|
61 | | - .enable_gpio = -1, |
---|
62 | 58 | }; |
---|
63 | 59 | |
---|
64 | 60 | static struct platform_device ezx_backlight_device = { |
---|
.. | .. |
---|
698 | 694 | |
---|
699 | 695 | #if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_A910) |
---|
700 | 696 | /* camera */ |
---|
701 | | -static struct regulator_consumer_supply camera_dummy_supplies[] = { |
---|
| 697 | +static struct regulator_consumer_supply camera_regulator_supplies[] = { |
---|
702 | 698 | REGULATOR_SUPPLY("vdd", "0-005d"), |
---|
703 | 699 | }; |
---|
704 | 700 | |
---|
705 | | -static struct regulator_init_data camera_dummy_initdata = { |
---|
706 | | - .consumer_supplies = camera_dummy_supplies, |
---|
707 | | - .num_consumer_supplies = ARRAY_SIZE(camera_dummy_supplies), |
---|
| 701 | +static struct regulator_init_data camera_regulator_initdata = { |
---|
| 702 | + .consumer_supplies = camera_regulator_supplies, |
---|
| 703 | + .num_consumer_supplies = ARRAY_SIZE(camera_regulator_supplies), |
---|
708 | 704 | .constraints = { |
---|
709 | 705 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
---|
710 | 706 | }, |
---|
711 | 707 | }; |
---|
712 | 708 | |
---|
713 | | -static struct fixed_voltage_config camera_dummy_config = { |
---|
| 709 | +static struct fixed_voltage_config camera_regulator_config = { |
---|
714 | 710 | .supply_name = "camera_vdd", |
---|
715 | 711 | .microvolts = 2800000, |
---|
716 | | - .gpio = GPIO50_nCAM_EN, |
---|
717 | | - .enable_high = 0, |
---|
718 | | - .init_data = &camera_dummy_initdata, |
---|
| 712 | + .init_data = &camera_regulator_initdata, |
---|
719 | 713 | }; |
---|
720 | 714 | |
---|
721 | | -static struct platform_device camera_supply_dummy_device = { |
---|
| 715 | +static struct platform_device camera_supply_regulator_device = { |
---|
722 | 716 | .name = "reg-fixed-voltage", |
---|
723 | 717 | .id = 1, |
---|
724 | 718 | .dev = { |
---|
725 | | - .platform_data = &camera_dummy_config, |
---|
| 719 | + .platform_data = &camera_regulator_config, |
---|
| 720 | + }, |
---|
| 721 | +}; |
---|
| 722 | + |
---|
| 723 | +static struct gpiod_lookup_table camera_supply_gpiod_table = { |
---|
| 724 | + .dev_id = "reg-fixed-voltage.1", |
---|
| 725 | + .table = { |
---|
| 726 | + GPIO_LOOKUP("gpio-pxa", GPIO50_nCAM_EN, |
---|
| 727 | + NULL, GPIO_ACTIVE_LOW), |
---|
| 728 | + { }, |
---|
726 | 729 | }, |
---|
727 | 730 | }; |
---|
728 | 731 | #endif |
---|
.. | .. |
---|
800 | 803 | |
---|
801 | 804 | static struct platform_device *a780_devices[] __initdata = { |
---|
802 | 805 | &a780_gpio_keys, |
---|
803 | | - &camera_supply_dummy_device, |
---|
| 806 | + &camera_supply_regulator_device, |
---|
804 | 807 | }; |
---|
805 | 808 | |
---|
806 | 809 | static void __init a780_init(void) |
---|
.. | .. |
---|
823 | 826 | if (a780_camera_init() == 0) |
---|
824 | 827 | pxa_set_camera_info(&a780_pxacamera_platform_data); |
---|
825 | 828 | |
---|
| 829 | + gpiod_add_lookup_table(&camera_supply_gpiod_table); |
---|
826 | 830 | pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup)); |
---|
827 | 831 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
---|
828 | 832 | platform_add_devices(ARRAY_AND_SIZE(a780_devices)); |
---|
.. | .. |
---|
1098 | 1102 | |
---|
1099 | 1103 | static struct platform_device *a910_devices[] __initdata = { |
---|
1100 | 1104 | &a910_gpio_keys, |
---|
1101 | | - &camera_supply_dummy_device, |
---|
| 1105 | + &camera_supply_regulator_device, |
---|
1102 | 1106 | }; |
---|
1103 | 1107 | |
---|
1104 | 1108 | static void __init a910_init(void) |
---|
.. | .. |
---|
1121 | 1125 | if (a910_camera_init() == 0) |
---|
1122 | 1126 | pxa_set_camera_info(&a910_pxacamera_platform_data); |
---|
1123 | 1127 | |
---|
| 1128 | + gpiod_add_lookup_table(&camera_supply_gpiod_table); |
---|
1124 | 1129 | pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup)); |
---|
1125 | 1130 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
---|
1126 | 1131 | platform_add_devices(ARRAY_AND_SIZE(a910_devices)); |
---|