forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 61598093bbdd283a7edc367d900f223070ead8d2
kernel/arch/arm/mach-pxa/ezx.c
....@@ -1,14 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * ezx.c - Common code for the EZX platform.
34 *
45 * Copyright (C) 2005-2006 Harald Welte <laforge@openezx.org>,
56 * 2007-2008 Daniel Ribeiro <drwyrm@gmail.com>,
67 * 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
- *
128 */
139
1410 #include <linux/kernel.h>
....@@ -21,6 +17,7 @@
2117 #include <linux/regulator/fixed.h>
2218 #include <linux/input.h>
2319 #include <linux/gpio.h>
20
+#include <linux/gpio/machine.h>
2421 #include <linux/gpio_keys.h>
2522 #include <linux/leds-lp3944.h>
2623 #include <linux/platform_data/i2c-pxa.h>
....@@ -58,7 +55,6 @@
5855 static struct platform_pwm_backlight_data ezx_backlight_data = {
5956 .max_brightness = 1023,
6057 .dft_brightness = 1023,
61
- .enable_gpio = -1,
6258 };
6359
6460 static struct platform_device ezx_backlight_device = {
....@@ -698,31 +694,38 @@
698694
699695 #if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_A910)
700696 /* camera */
701
-static struct regulator_consumer_supply camera_dummy_supplies[] = {
697
+static struct regulator_consumer_supply camera_regulator_supplies[] = {
702698 REGULATOR_SUPPLY("vdd", "0-005d"),
703699 };
704700
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),
708704 .constraints = {
709705 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
710706 },
711707 };
712708
713
-static struct fixed_voltage_config camera_dummy_config = {
709
+static struct fixed_voltage_config camera_regulator_config = {
714710 .supply_name = "camera_vdd",
715711 .microvolts = 2800000,
716
- .gpio = GPIO50_nCAM_EN,
717
- .enable_high = 0,
718
- .init_data = &camera_dummy_initdata,
712
+ .init_data = &camera_regulator_initdata,
719713 };
720714
721
-static struct platform_device camera_supply_dummy_device = {
715
+static struct platform_device camera_supply_regulator_device = {
722716 .name = "reg-fixed-voltage",
723717 .id = 1,
724718 .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
+ { },
726729 },
727730 };
728731 #endif
....@@ -800,7 +803,7 @@
800803
801804 static struct platform_device *a780_devices[] __initdata = {
802805 &a780_gpio_keys,
803
- &camera_supply_dummy_device,
806
+ &camera_supply_regulator_device,
804807 };
805808
806809 static void __init a780_init(void)
....@@ -823,6 +826,7 @@
823826 if (a780_camera_init() == 0)
824827 pxa_set_camera_info(&a780_pxacamera_platform_data);
825828
829
+ gpiod_add_lookup_table(&camera_supply_gpiod_table);
826830 pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
827831 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
828832 platform_add_devices(ARRAY_AND_SIZE(a780_devices));
....@@ -1098,7 +1102,7 @@
10981102
10991103 static struct platform_device *a910_devices[] __initdata = {
11001104 &a910_gpio_keys,
1101
- &camera_supply_dummy_device,
1105
+ &camera_supply_regulator_device,
11021106 };
11031107
11041108 static void __init a910_init(void)
....@@ -1121,6 +1125,7 @@
11211125 if (a910_camera_init() == 0)
11221126 pxa_set_camera_info(&a910_pxacamera_platform_data);
11231127
1128
+ gpiod_add_lookup_table(&camera_supply_gpiod_table);
11241129 pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
11251130 platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
11261131 platform_add_devices(ARRAY_AND_SIZE(a910_devices));