forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 61598093bbdd283a7edc367d900f223070ead8d2
kernel/arch/arm/mach-pxa/palmz72.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Hardware definitions for Palm Zire72
34 *
....@@ -10,12 +11,7 @@
1011 * Rewrite for mainline:
1112 * Marek Vasut <marek.vasut@gmail.com>
1213 *
13
- * This program is free software; you can redistribute it and/or modify
14
- * it under the terms of the GNU General Public License version 2 as
15
- * published by the Free Software Foundation.
16
- *
1714 * (find more info at www.hackndev.com)
18
- *
1915 */
2016
2117 #include <linux/platform_device.h>
....@@ -29,7 +25,6 @@
2925 #include <linux/gpio.h>
3026 #include <linux/wm97xx.h>
3127 #include <linux/power_supply.h>
32
-#include <linux/usb/gpio_vbus.h>
3328 #include <linux/platform_data/i2c-gpio.h>
3429 #include <linux/gpio/machine.h>
3530
....@@ -51,8 +46,6 @@
5146
5247 #include "pm.h"
5348 #include <linux/platform_data/media/camera-pxa.h>
54
-
55
-#include <media/soc_camera.h>
5649
5750 #include "generic.h"
5851 #include "devices.h"
....@@ -277,114 +270,18 @@
277270 device_initcall(palmz72_pm_init);
278271 #endif
279272
280
-/******************************************************************************
281
- * SoC Camera
282
- ******************************************************************************/
283
-#if defined(CONFIG_SOC_CAMERA_OV9640) || \
284
- defined(CONFIG_SOC_CAMERA_OV9640_MODULE)
285
-static struct pxacamera_platform_data palmz72_pxacamera_platform_data = {
286
- .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
287
- PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN,
288
- .mclk_10khz = 2600,
289
-};
290
-
291
-/* Board I2C devices. */
292
-static struct i2c_board_info palmz72_i2c_device[] = {
293
- {
294
- I2C_BOARD_INFO("ov9640", 0x30),
295
- }
296
-};
297
-
298
-static int palmz72_camera_power(struct device *dev, int power)
299
-{
300
- gpio_set_value(GPIO_NR_PALMZ72_CAM_PWDN, !power);
301
- mdelay(50);
302
- return 0;
303
-}
304
-
305
-static int palmz72_camera_reset(struct device *dev)
306
-{
307
- gpio_set_value(GPIO_NR_PALMZ72_CAM_RESET, 1);
308
- mdelay(50);
309
- gpio_set_value(GPIO_NR_PALMZ72_CAM_RESET, 0);
310
- mdelay(50);
311
- return 0;
312
-}
313
-
314
-static struct soc_camera_link palmz72_iclink = {
315
- .bus_id = 0, /* Match id in pxa27x_device_camera in device.c */
316
- .board_info = &palmz72_i2c_device[0],
317
- .i2c_adapter_id = 0,
318
- .module_name = "ov96xx",
319
- .power = &palmz72_camera_power,
320
- .reset = &palmz72_camera_reset,
321
- .flags = SOCAM_DATAWIDTH_8,
322
-};
323
-
324
-static struct gpiod_lookup_table palmz72_i2c_gpiod_table = {
325
- .dev_id = "i2c-gpio.0",
326
- .table = {
327
- GPIO_LOOKUP_IDX("gpio-pxa", 118, NULL, 0,
328
- GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
329
- GPIO_LOOKUP_IDX("gpio-pxa", 117, NULL, 1,
330
- GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
273
+static struct gpiod_lookup_table palmz72_mci_gpio_table = {
274
+ .dev_id = "pxa2xx-mci.0",
275
+ .table = {
276
+ GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMZ72_SD_DETECT_N,
277
+ "cd", GPIO_ACTIVE_LOW),
278
+ GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMZ72_SD_RO,
279
+ "wp", GPIO_ACTIVE_LOW),
280
+ GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMZ72_SD_POWER_N,
281
+ "power", GPIO_ACTIVE_LOW),
282
+ { },
331283 },
332284 };
333
-
334
-static struct i2c_gpio_platform_data palmz72_i2c_bus_data = {
335
- .udelay = 10,
336
- .timeout = 100,
337
-};
338
-
339
-static struct platform_device palmz72_i2c_bus_device = {
340
- .name = "i2c-gpio",
341
- .id = 0, /* we use this as a replacement for i2c-pxa */
342
- .dev = {
343
- .platform_data = &palmz72_i2c_bus_data,
344
- }
345
-};
346
-
347
-static struct platform_device palmz72_camera = {
348
- .name = "soc-camera-pdrv",
349
- .id = -1,
350
- .dev = {
351
- .platform_data = &palmz72_iclink,
352
- },
353
-};
354
-
355
-/* Here we request the camera GPIOs and configure them. We power up the camera
356
- * module, deassert the reset pin, but put it into powerdown (low to no power
357
- * consumption) mode. This allows us to later bring the module up fast. */
358
-static struct gpio palmz72_camera_gpios[] = {
359
- { GPIO_NR_PALMZ72_CAM_POWER, GPIOF_INIT_HIGH,"Camera DVDD" },
360
- { GPIO_NR_PALMZ72_CAM_RESET, GPIOF_INIT_LOW, "Camera RESET" },
361
- { GPIO_NR_PALMZ72_CAM_PWDN, GPIOF_INIT_LOW, "Camera PWDN" },
362
-};
363
-
364
-static inline void __init palmz72_cam_gpio_init(void)
365
-{
366
- int ret;
367
-
368
- ret = gpio_request_array(ARRAY_AND_SIZE(palmz72_camera_gpios));
369
- if (!ret)
370
- gpio_free_array(ARRAY_AND_SIZE(palmz72_camera_gpios));
371
- else
372
- printk(KERN_ERR "Camera GPIO init failed!\n");
373
-
374
- return;
375
-}
376
-
377
-static void __init palmz72_camera_init(void)
378
-{
379
- palmz72_cam_gpio_init();
380
- pxa_set_camera_info(&palmz72_pxacamera_platform_data);
381
- gpiod_add_lookup_table(&palmz72_i2c_gpiod_table);
382
- platform_device_register(&palmz72_i2c_bus_device);
383
- platform_device_register(&palmz72_camera);
384
-}
385
-#else
386
-static inline void palmz72_camera_init(void) {}
387
-#endif
388285
389286 /******************************************************************************
390287 * Machine init
....@@ -396,8 +293,7 @@
396293 pxa_set_btuart_info(NULL);
397294 pxa_set_stuart_info(NULL);
398295
399
- palm27x_mmc_init(GPIO_NR_PALMZ72_SD_DETECT_N, GPIO_NR_PALMZ72_SD_RO,
400
- GPIO_NR_PALMZ72_SD_POWER_N, 1);
296
+ palm27x_mmc_init(&palmz72_mci_gpio_table);
401297 palm27x_lcd_init(-1, &palm_320x320_lcd_mode);
402298 palm27x_udc_init(GPIO_NR_PALMZ72_USB_DETECT_N,
403299 GPIO_NR_PALMZ72_USB_PULLUP, 0);
....@@ -409,7 +305,6 @@
409305 palm27x_pmic_init();
410306 palmz72_kpc_init();
411307 palmz72_leds_init();
412
- palmz72_camera_init();
413308 }
414309
415310 MACHINE_START(PALMZ72, "Palm Zire72")