.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * arch/arm/mach-pxa/pcm990-baseboard.c |
---|
3 | 4 | * Support for the Phytec phyCORE-PXA270 Development Platform (PCM-990). |
---|
.. | .. |
---|
14 | 15 | * based on Intel Mainstone Board |
---|
15 | 16 | * |
---|
16 | 17 | * Copyright 2007 Juergen Beisert @ Pengutronix (j.beisert@pengutronix.de) |
---|
17 | | - * |
---|
18 | | - * This program is free software; you can redistribute it and/or modify |
---|
19 | | - * it under the terms of the GNU General Public License version 2 as |
---|
20 | | - * published by the Free Software Foundation. |
---|
21 | 18 | */ |
---|
22 | 19 | #include <linux/gpio.h> |
---|
23 | 20 | #include <linux/irq.h> |
---|
.. | .. |
---|
27 | 24 | #include <linux/pwm.h> |
---|
28 | 25 | #include <linux/pwm_backlight.h> |
---|
29 | 26 | |
---|
30 | | -#include <media/i2c/mt9v022.h> |
---|
31 | | -#include <media/soc_camera.h> |
---|
32 | | - |
---|
33 | | -#include <linux/platform_data/media/camera-pxa.h> |
---|
34 | 27 | #include <asm/mach/map.h> |
---|
35 | 28 | #include "pxa27x.h" |
---|
36 | 29 | #include <mach/audio.h> |
---|
.. | .. |
---|
157 | 150 | static struct platform_pwm_backlight_data pcm990_backlight_data = { |
---|
158 | 151 | .max_brightness = 1023, |
---|
159 | 152 | .dft_brightness = 1023, |
---|
160 | | - .enable_gpio = -1, |
---|
161 | 153 | }; |
---|
162 | 154 | |
---|
163 | 155 | static struct platform_device pcm990_backlight_device = { |
---|
.. | .. |
---|
370 | 362 | .init = pcm990_mci_init, |
---|
371 | 363 | .setpower = pcm990_mci_setpower, |
---|
372 | 364 | .exit = pcm990_mci_exit, |
---|
373 | | - .gpio_card_detect = -1, |
---|
374 | | - .gpio_card_ro = -1, |
---|
375 | | - .gpio_power = -1, |
---|
376 | 365 | }; |
---|
377 | 366 | |
---|
378 | 367 | static struct pxaohci_platform_data pcm990_ohci_platform_data = { |
---|
.. | .. |
---|
380 | 369 | .flags = ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW, |
---|
381 | 370 | .power_on_delay = 10, |
---|
382 | 371 | }; |
---|
383 | | - |
---|
384 | | -/* |
---|
385 | | - * PXA27x Camera specific stuff |
---|
386 | | - */ |
---|
387 | | -#if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE) |
---|
388 | | -static unsigned long pcm990_camera_pin_config[] = { |
---|
389 | | - /* CIF */ |
---|
390 | | - GPIO98_CIF_DD_0, |
---|
391 | | - GPIO105_CIF_DD_1, |
---|
392 | | - GPIO104_CIF_DD_2, |
---|
393 | | - GPIO103_CIF_DD_3, |
---|
394 | | - GPIO95_CIF_DD_4, |
---|
395 | | - GPIO94_CIF_DD_5, |
---|
396 | | - GPIO93_CIF_DD_6, |
---|
397 | | - GPIO108_CIF_DD_7, |
---|
398 | | - GPIO107_CIF_DD_8, |
---|
399 | | - GPIO106_CIF_DD_9, |
---|
400 | | - GPIO42_CIF_MCLK, |
---|
401 | | - GPIO45_CIF_PCLK, |
---|
402 | | - GPIO43_CIF_FV, |
---|
403 | | - GPIO44_CIF_LV, |
---|
404 | | -}; |
---|
405 | | - |
---|
406 | | -/* |
---|
407 | | - * CICR4: PCLK_EN: Pixel clock is supplied by the sensor |
---|
408 | | - * MCLK_EN: Master clock is generated by PXA |
---|
409 | | - * PCP: Data sampled on the falling edge of pixel clock |
---|
410 | | - */ |
---|
411 | | -struct pxacamera_platform_data pcm990_pxacamera_platform_data = { |
---|
412 | | - .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 | PXA_CAMERA_DATAWIDTH_10 | |
---|
413 | | - PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN/* | PXA_CAMERA_PCP*/, |
---|
414 | | - .mclk_10khz = 1000, |
---|
415 | | -}; |
---|
416 | | - |
---|
417 | | -#include <linux/platform_data/pca953x.h> |
---|
418 | | - |
---|
419 | | -static struct pca953x_platform_data pca9536_data = { |
---|
420 | | - .gpio_base = PXA_NR_BUILTIN_GPIO, |
---|
421 | | -}; |
---|
422 | | - |
---|
423 | | -static int gpio_bus_switch = -EINVAL; |
---|
424 | | - |
---|
425 | | -static int pcm990_camera_set_bus_param(struct soc_camera_link *link, |
---|
426 | | - unsigned long flags) |
---|
427 | | -{ |
---|
428 | | - if (gpio_bus_switch < 0) { |
---|
429 | | - if (flags == SOCAM_DATAWIDTH_10) |
---|
430 | | - return 0; |
---|
431 | | - else |
---|
432 | | - return -EINVAL; |
---|
433 | | - } |
---|
434 | | - |
---|
435 | | - if (flags & SOCAM_DATAWIDTH_8) |
---|
436 | | - gpio_set_value_cansleep(gpio_bus_switch, 1); |
---|
437 | | - else |
---|
438 | | - gpio_set_value_cansleep(gpio_bus_switch, 0); |
---|
439 | | - |
---|
440 | | - return 0; |
---|
441 | | -} |
---|
442 | | - |
---|
443 | | -static unsigned long pcm990_camera_query_bus_param(struct soc_camera_link *link) |
---|
444 | | -{ |
---|
445 | | - int ret; |
---|
446 | | - |
---|
447 | | - if (gpio_bus_switch < 0) { |
---|
448 | | - ret = gpio_request(PXA_NR_BUILTIN_GPIO, "camera"); |
---|
449 | | - if (!ret) { |
---|
450 | | - gpio_bus_switch = PXA_NR_BUILTIN_GPIO; |
---|
451 | | - gpio_direction_output(gpio_bus_switch, 0); |
---|
452 | | - } |
---|
453 | | - } |
---|
454 | | - |
---|
455 | | - if (gpio_bus_switch >= 0) |
---|
456 | | - return SOCAM_DATAWIDTH_8 | SOCAM_DATAWIDTH_10; |
---|
457 | | - else |
---|
458 | | - return SOCAM_DATAWIDTH_10; |
---|
459 | | -} |
---|
460 | | - |
---|
461 | | -static void pcm990_camera_free_bus(struct soc_camera_link *link) |
---|
462 | | -{ |
---|
463 | | - if (gpio_bus_switch < 0) |
---|
464 | | - return; |
---|
465 | | - |
---|
466 | | - gpio_free(gpio_bus_switch); |
---|
467 | | - gpio_bus_switch = -EINVAL; |
---|
468 | | -} |
---|
469 | | - |
---|
470 | | -/* Board I2C devices. */ |
---|
471 | | -static struct i2c_board_info __initdata pcm990_i2c_devices[] = { |
---|
472 | | - { |
---|
473 | | - /* Must initialize before the camera(s) */ |
---|
474 | | - I2C_BOARD_INFO("pca9536", 0x41), |
---|
475 | | - .platform_data = &pca9536_data, |
---|
476 | | - }, |
---|
477 | | -}; |
---|
478 | | - |
---|
479 | | -static struct mt9v022_platform_data mt9v022_pdata = { |
---|
480 | | - .y_skip_top = 1, |
---|
481 | | -}; |
---|
482 | | - |
---|
483 | | -static struct i2c_board_info pcm990_camera_i2c[] = { |
---|
484 | | - { |
---|
485 | | - I2C_BOARD_INFO("mt9v022", 0x48), |
---|
486 | | - }, { |
---|
487 | | - I2C_BOARD_INFO("mt9m001", 0x5d), |
---|
488 | | - }, |
---|
489 | | -}; |
---|
490 | | - |
---|
491 | | -static struct soc_camera_link iclink[] = { |
---|
492 | | - { |
---|
493 | | - .bus_id = 0, /* Must match with the camera ID */ |
---|
494 | | - .board_info = &pcm990_camera_i2c[0], |
---|
495 | | - .priv = &mt9v022_pdata, |
---|
496 | | - .i2c_adapter_id = 0, |
---|
497 | | - .query_bus_param = pcm990_camera_query_bus_param, |
---|
498 | | - .set_bus_param = pcm990_camera_set_bus_param, |
---|
499 | | - .free_bus = pcm990_camera_free_bus, |
---|
500 | | - }, { |
---|
501 | | - .bus_id = 0, /* Must match with the camera ID */ |
---|
502 | | - .board_info = &pcm990_camera_i2c[1], |
---|
503 | | - .i2c_adapter_id = 0, |
---|
504 | | - .query_bus_param = pcm990_camera_query_bus_param, |
---|
505 | | - .set_bus_param = pcm990_camera_set_bus_param, |
---|
506 | | - .free_bus = pcm990_camera_free_bus, |
---|
507 | | - }, |
---|
508 | | -}; |
---|
509 | | - |
---|
510 | | -static struct platform_device pcm990_camera[] = { |
---|
511 | | - { |
---|
512 | | - .name = "soc-camera-pdrv", |
---|
513 | | - .id = 0, |
---|
514 | | - .dev = { |
---|
515 | | - .platform_data = &iclink[0], |
---|
516 | | - }, |
---|
517 | | - }, { |
---|
518 | | - .name = "soc-camera-pdrv", |
---|
519 | | - .id = 1, |
---|
520 | | - .dev = { |
---|
521 | | - .platform_data = &iclink[1], |
---|
522 | | - }, |
---|
523 | | - }, |
---|
524 | | -}; |
---|
525 | | -#endif /* CONFIG_VIDEO_PXA27x ||CONFIG_VIDEO_PXA27x_MODULE */ |
---|
526 | 372 | |
---|
527 | 373 | /* |
---|
528 | 374 | * system init for baseboard usage. Will be called by pcm027 init. |
---|
.. | .. |
---|
557 | 403 | |
---|
558 | 404 | pxa_set_i2c_info(NULL); |
---|
559 | 405 | pxa_set_ac97_info(NULL); |
---|
560 | | - |
---|
561 | | -#if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE) |
---|
562 | | - pxa2xx_mfp_config(ARRAY_AND_SIZE(pcm990_camera_pin_config)); |
---|
563 | | - pxa_set_camera_info(&pcm990_pxacamera_platform_data); |
---|
564 | | - |
---|
565 | | - i2c_register_board_info(0, ARRAY_AND_SIZE(pcm990_i2c_devices)); |
---|
566 | | - |
---|
567 | | - platform_device_register(&pcm990_camera[0]); |
---|
568 | | - platform_device_register(&pcm990_camera[1]); |
---|
569 | | -#endif |
---|
570 | 406 | |
---|
571 | 407 | printk(KERN_INFO "PCM-990 Evaluation baseboard initialized\n"); |
---|
572 | 408 | } |
---|