diff options
author | Koen Kooi <koen@dominion.thruhere.net> | 2012-07-30 20:41:14 +0200 |
---|---|---|
committer | Denys Dmytriyenko <denys@ti.com> | 2012-09-14 01:50:35 -0400 |
commit | e4ea426bb5e7b9dc18cd9fc1e820744c05b63561 (patch) | |
tree | 0d670242289fce52300c226ce0b86829a062f810 /recipes-kernel/linux/linux-ti33x-psp-3.2 | |
parent | 306bec90c470a0130714dca2b506ba2e8da86144 (diff) | |
download | meta-ti-e4ea426bb5e7b9dc18cd9fc1e820744c05b63561.tar.gz |
linux-ti33x-psp 3.2: LCD7 A3 support, eMMC cape support, camera cape improvements
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Signed-off-by: Denys Dmytriyenko <denys@ti.com>
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2')
4 files changed, 605 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0081-beaglebone-add-support-for-LCD7-A3.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0081-beaglebone-add-support-for-LCD7-A3.patch new file mode 100644 index 00000000..07f7afc5 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0081-beaglebone-add-support-for-LCD7-A3.patch | |||
@@ -0,0 +1,144 @@ | |||
1 | From 44bfbc3cbd6ddc95db9a886744582ffddb79fe47 Mon Sep 17 00:00:00 2001 | ||
2 | From: Koen Kooi <koen@dominion.thruhere.net> | ||
3 | Date: Tue, 24 Jul 2012 13:23:28 +0200 | ||
4 | Subject: [PATCH 81/84] beaglebone: add support for LCD7 A3 | ||
5 | |||
6 | --- | ||
7 | arch/arm/mach-omap2/board-am335xevm.c | 93 ++++++++++++++++++++++++++++++++- | ||
8 | 1 files changed, 92 insertions(+), 1 deletions(-) | ||
9 | |||
10 | diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c | ||
11 | index 82020fc..0c305b6 100644 | ||
12 | --- a/arch/arm/mach-omap2/board-am335xevm.c | ||
13 | +++ b/arch/arm/mach-omap2/board-am335xevm.c | ||
14 | @@ -660,6 +660,12 @@ static struct pinmux_config bbtoys7a2_pin_mux[] = { | ||
15 | {NULL, 0}, | ||
16 | }; | ||
17 | |||
18 | +/* Module pin mux for Beagleboardtoys 7" LCD cape */ | ||
19 | +static struct pinmux_config bbtoys7a3_pin_mux[] = { | ||
20 | + {"spi0_sclk.gpio0_2", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, // AVDD_EN | ||
21 | + {"gpmc_a2.ehrpwm1A", OMAP_MUX_MODE6 | AM33XX_PIN_OUTPUT}, // Backlight | ||
22 | + {NULL, 0}, | ||
23 | +}; | ||
24 | |||
25 | static struct pinmux_config w1_gpio_pin_mux[] = { | ||
26 | {"gpmc_ad3.gpio1_3", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP}, | ||
27 | @@ -1164,6 +1170,82 @@ static void beaglebone_lcd7_keys_init(int evm_id, int profile) | ||
28 | pr_err("failed to register gpio keys for LCD7 cape\n"); | ||
29 | } | ||
30 | |||
31 | +/* pinmux for lcd7 keys */ | ||
32 | +static struct pinmux_config lcd7a3_keys_pin_mux[] = { | ||
33 | + {"gpmc_a0.gpio1_16", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT}, //left | ||
34 | + {"gpmc_a1.gpio1_17", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT}, //right | ||
35 | + {"gpmc_a3.gpio1_19", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT}, //up | ||
36 | + {"mcasp0_axr0.gpio3_16", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT}, //down | ||
37 | + {"sdpi0_d0.gpio0_3", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT}, //enter | ||
38 | + {NULL, 0}, | ||
39 | +}; | ||
40 | + | ||
41 | +/* Configure GPIOs for lcd7 keys */ | ||
42 | +static struct gpio_keys_button beaglebone_lcd7a3_gpio_keys[] = { | ||
43 | + { | ||
44 | + .code = KEY_LEFT, | ||
45 | + .gpio = GPIO_TO_PIN(1, 16), | ||
46 | + .active_low = true, | ||
47 | + .desc = "left", | ||
48 | + .type = EV_KEY, | ||
49 | + .wakeup = 1, | ||
50 | + }, | ||
51 | + { | ||
52 | + .code = KEY_RIGHT, | ||
53 | + .gpio = GPIO_TO_PIN(1, 17), | ||
54 | + .active_low = true, | ||
55 | + .desc = "right", | ||
56 | + .type = EV_KEY, | ||
57 | + .wakeup = 1, | ||
58 | + }, | ||
59 | + { | ||
60 | + .code = KEY_UP, | ||
61 | + .gpio = GPIO_TO_PIN(1, 19), | ||
62 | + .active_low = true, | ||
63 | + .desc = "up", | ||
64 | + .type = EV_KEY, | ||
65 | + .wakeup = 1, | ||
66 | + }, | ||
67 | + { | ||
68 | + .code = KEY_DOWN, | ||
69 | + .gpio = GPIO_TO_PIN(3, 16), | ||
70 | + .active_low = true, | ||
71 | + .desc = "down", | ||
72 | + .type = EV_KEY, | ||
73 | + .wakeup = 1, | ||
74 | + }, | ||
75 | + { | ||
76 | + .code = KEY_ENTER, | ||
77 | + .gpio = GPIO_TO_PIN(0, 3), | ||
78 | + .active_low = true, | ||
79 | + .desc = "enter", | ||
80 | + .type = EV_KEY, | ||
81 | + .wakeup = 1, | ||
82 | + }, | ||
83 | +}; | ||
84 | + | ||
85 | +static struct gpio_keys_platform_data beaglebone_lcd7a3_gpio_key_info = { | ||
86 | + .buttons = beaglebone_lcd7a3_gpio_keys, | ||
87 | + .nbuttons = ARRAY_SIZE(beaglebone_lcd7a3_gpio_keys), | ||
88 | +}; | ||
89 | + | ||
90 | +static struct platform_device beaglebone_lcd7a3_keys = { | ||
91 | + .name = "gpio-keys", | ||
92 | + .id = -1, | ||
93 | + .dev = { | ||
94 | + .platform_data = &beaglebone_lcd7a3_gpio_key_info, | ||
95 | + }, | ||
96 | +}; | ||
97 | + | ||
98 | +static void beaglebone_lcd7a3_keys_init(int evm_id, int profile) | ||
99 | +{ | ||
100 | + int err; | ||
101 | + setup_pin_mux(lcd7a3_keys_pin_mux); | ||
102 | + err = platform_device_register(&beaglebone_lcd7a3_keys); | ||
103 | + if (err) | ||
104 | + pr_err("failed to register gpio keys for LCD7 cape\n"); | ||
105 | +} | ||
106 | + | ||
107 | /* pinmux for lcd3 keys */ | ||
108 | static struct pinmux_config lcd3_keys_pin_mux[] = { | ||
109 | {"gpmc_a0.gpio1_16", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT}, | ||
110 | @@ -1719,6 +1801,7 @@ static void lcdc_init(int evm_id, int profile) | ||
111 | |||
112 | #define BEAGLEBONE_LCD_AVDD_EN GPIO_TO_PIN(0, 7) | ||
113 | #define BEAGLEBONE_LCD7A2_AVDD_EN GPIO_TO_PIN(1, 31) | ||
114 | +#define BEAGLEBONE_LCD7A3_AVDD_EN GPIO_TO_PIN(0, 2) | ||
115 | |||
116 | static void bbtoys7lcd_init(int evm_id, int profile) | ||
117 | { | ||
118 | @@ -2934,6 +3017,10 @@ static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context | ||
119 | setup_pin_mux(bbtoys7a2_pin_mux); | ||
120 | gpio_request(BEAGLEBONE_LCD7A2_AVDD_EN, "BONE_LCD_AVDD_EN"); | ||
121 | gpio_direction_output(BEAGLEBONE_LCD7A2_AVDD_EN, 1); | ||
122 | + } else if(!strncmp("00A3", cape_config.version, 4)) { | ||
123 | + setup_pin_mux(bbtoys7a3_pin_mux); | ||
124 | + gpio_request(BEAGLEBONE_LCD7A3_AVDD_EN, "BONE_LCD_AVDD_EN"); | ||
125 | + gpio_direction_output(BEAGLEBONE_LCD7A3_AVDD_EN, 1); | ||
126 | } else { | ||
127 | setup_pin_mux(bbtoys7_pin_mux); | ||
128 | gpio_request(BEAGLEBONE_LCD_AVDD_EN, "BONE_LCD_AVDD_EN"); | ||
129 | @@ -2948,7 +3035,11 @@ static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context | ||
130 | enable_ehrpwm1(0,0); | ||
131 | beaglebone_tsadcpins_free = 0; | ||
132 | pr_info("BeagleBone cape: Registering gpio-keys for LCD cape\n"); | ||
133 | - beaglebone_lcd7_keys_init(0,0); | ||
134 | + if (!strncmp("00A3", cape_config.version, 4)) { | ||
135 | + beaglebone_lcd7a3_keys_init(0,0); | ||
136 | + } else { | ||
137 | + beaglebone_lcd7_keys_init(0,0); | ||
138 | + } | ||
139 | |||
140 | beaglebone_spi1_free = 0; | ||
141 | // A1 or newer | ||
142 | -- | ||
143 | 1.7.7.6 | ||
144 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0082-beaglebone-add-rudimentary-support-for-eMMC-cape.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0082-beaglebone-add-rudimentary-support-for-eMMC-cape.patch new file mode 100644 index 00000000..737705c4 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0082-beaglebone-add-rudimentary-support-for-eMMC-cape.patch | |||
@@ -0,0 +1,111 @@ | |||
1 | From 9fd45d5967c0e09c57e2cf41e4bf26dadf31eb16 Mon Sep 17 00:00:00 2001 | ||
2 | From: Koen Kooi <koen@dominion.thruhere.net> | ||
3 | Date: Thu, 26 Jul 2012 22:30:34 +0200 | ||
4 | Subject: [PATCH 82/84] beaglebone: add rudimentary support for eMMC cape | ||
5 | |||
6 | Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> | ||
7 | --- | ||
8 | arch/arm/mach-omap2/board-am335xevm.c | 42 ++++++++++++++++++++++++-------- | ||
9 | 1 files changed, 31 insertions(+), 11 deletions(-) | ||
10 | |||
11 | diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c | ||
12 | index 0c305b6..579df6c 100644 | ||
13 | --- a/arch/arm/mach-omap2/board-am335xevm.c | ||
14 | +++ b/arch/arm/mach-omap2/board-am335xevm.c | ||
15 | @@ -913,6 +913,7 @@ static struct pinmux_config mmc1_pin_mux[] = { | ||
16 | {"gpmc_csn2.mmc1_cmd", OMAP_MUX_MODE2 | AM33XX_PIN_INPUT_PULLUP}, | ||
17 | {"gpmc_csn0.gpio1_29", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP}, | ||
18 | {"gpmc_advn_ale.mmc1_sdcd", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP}, | ||
19 | + {"uart1_rxd.mmc1_sdwp", OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLDOWN}, | ||
20 | {NULL, 0}, | ||
21 | }; | ||
22 | |||
23 | @@ -2627,6 +2628,28 @@ static void mcasp0_init(int evm_id, int profile) | ||
24 | return; | ||
25 | } | ||
26 | |||
27 | +static void mmc0_init(int evm_id, int profile) | ||
28 | +{ | ||
29 | + setup_pin_mux(mmc0_pin_mux); | ||
30 | + | ||
31 | + omap2_hsmmc_init(am335x_mmc); | ||
32 | + return; | ||
33 | +} | ||
34 | + | ||
35 | +static void emmc_bone_init(int evm_id, int profile) | ||
36 | +{ | ||
37 | + printk("cape: emmc_bone_init\n"); | ||
38 | + setup_pin_mux(mmc1_pin_mux); | ||
39 | + am335x_mmc[1].mmc = 2; | ||
40 | + am335x_mmc[1].caps = MMC_CAP_4_BIT_DATA; | ||
41 | + am335x_mmc[1].nonremovable = true; | ||
42 | + am335x_mmc[1].gpio_cd = -EINVAL; | ||
43 | + am335x_mmc[1].gpio_wp = -EINVAL; | ||
44 | + am335x_mmc[1].ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34; /* 3V3 */ | ||
45 | + /* mmc will be initialized when mmc0_init is called */ | ||
46 | + return; | ||
47 | +} | ||
48 | + | ||
49 | static const char* cape_pins[] = { | ||
50 | /* | ||
51 | From SRM RevA5.0.1: | ||
52 | @@ -2923,7 +2946,6 @@ static int bone_io_config_from_cape_eeprom( void) | ||
53 | RULER( NR_ITEMS( cape_config.muxdata)); | ||
54 | return 0; | ||
55 | } | ||
56 | - | ||
57 | static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context) | ||
58 | { | ||
59 | int ret; | ||
60 | @@ -3102,6 +3124,12 @@ static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context | ||
61 | #endif | ||
62 | */ | ||
63 | } | ||
64 | + | ||
65 | + if (!strncmp("BB-BONE-eMMC1-01", cape_config.partnumber, 15)) { | ||
66 | + pr_info("BeagleBone cape: initializing eMMC cape\n"); | ||
67 | + beaglebone_w1gpio_free = 0; | ||
68 | + emmc_bone_init(0,0); | ||
69 | + } | ||
70 | |||
71 | if (!strncmp("BB-BONE-SERL-01", cape_config.partnumber, 15)) { | ||
72 | pr_info("BeagleBone cape: initializing CAN cape\n"); | ||
73 | @@ -3147,6 +3175,7 @@ out: | ||
74 | beaglebone_cape_detected = false; | ||
75 | out2: | ||
76 | if (capecount > 3) { | ||
77 | + mmc0_init(0,0); | ||
78 | if (beaglebone_tsadcpins_free == 1) { | ||
79 | pr_info("BeagleBone cape: exporting ADC pins to sysfs\n"); | ||
80 | bone_tsc_init(0,0); | ||
81 | @@ -3338,14 +3367,6 @@ static void d_can_init(int evm_id, int profile) | ||
82 | } | ||
83 | } | ||
84 | |||
85 | -static void mmc0_init(int evm_id, int profile) | ||
86 | -{ | ||
87 | - setup_pin_mux(mmc0_pin_mux); | ||
88 | - | ||
89 | - omap2_hsmmc_init(am335x_mmc); | ||
90 | - return; | ||
91 | -} | ||
92 | - | ||
93 | static struct i2c_board_info tps65217_i2c_boardinfo[] = { | ||
94 | { | ||
95 | I2C_BOARD_INFO("tps65217", TPS65217_I2C_ID), | ||
96 | @@ -3589,11 +3610,10 @@ static struct evm_dev_cfg beaglebone_old_dev_cfg[] = { | ||
97 | /* Beaglebone Rev A3 and after */ | ||
98 | static struct evm_dev_cfg beaglebone_dev_cfg[] = { | ||
99 | {tps65217_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
100 | + {i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
101 | {mii1_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
102 | {usb0_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
103 | {usb1_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
104 | - {i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
105 | - {mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE}, | ||
106 | {NULL, 0, 0}, | ||
107 | }; | ||
108 | |||
109 | -- | ||
110 | 1.7.7.6 | ||
111 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0083-beaglebone-add-extra-partnumber-for-camera-cape.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0083-beaglebone-add-extra-partnumber-for-camera-cape.patch new file mode 100644 index 00000000..152ac224 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0083-beaglebone-add-extra-partnumber-for-camera-cape.patch | |||
@@ -0,0 +1,26 @@ | |||
1 | From b9d6ae7ba8604c3c8ce64c53073990a831611414 Mon Sep 17 00:00:00 2001 | ||
2 | From: Koen Kooi <koen@dominion.thruhere.net> | ||
3 | Date: Thu, 26 Jul 2012 22:31:30 +0200 | ||
4 | Subject: [PATCH 83/84] beaglebone: add extra partnumber for camera cape | ||
5 | |||
6 | Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> | ||
7 | --- | ||
8 | arch/arm/mach-omap2/board-am335xevm.c | 2 +- | ||
9 | 1 files changed, 1 insertions(+), 1 deletions(-) | ||
10 | |||
11 | diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c | ||
12 | index 579df6c..3b6f354 100644 | ||
13 | --- a/arch/arm/mach-omap2/board-am335xevm.c | ||
14 | +++ b/arch/arm/mach-omap2/board-am335xevm.c | ||
15 | @@ -3158,7 +3158,7 @@ static void beaglebone_cape_setup(struct memory_accessor *mem_acc, void *context | ||
16 | tt3201_init(0,0); | ||
17 | } | ||
18 | |||
19 | - if (!strncmp("BB-BONE-CAM-01", cape_config.partnumber, 14)) { | ||
20 | + if (!strncmp("BB-BONE-CAM-01", cape_config.partnumber, 14) || !strncmp("BB-BONE-CAM3-01", cape_config.partnumber, 15)) { | ||
21 | pr_info("BeagleBone cape: recognized Camera cape\n"); | ||
22 | beaglebone_w1gpio_free = 0; | ||
23 | cssp_gpmc_init(); | ||
24 | -- | ||
25 | 1.7.7.6 | ||
26 | |||
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0084-beaglebone-cssp_camera-driver-cleanup.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0084-beaglebone-cssp_camera-driver-cleanup.patch new file mode 100644 index 00000000..5dc325d6 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/beaglebone/0084-beaglebone-cssp_camera-driver-cleanup.patch | |||
@@ -0,0 +1,324 @@ | |||
1 | From b9f772af6c2b9116bad19371e4547af86b4ac18d Mon Sep 17 00:00:00 2001 | ||
2 | From: Dan Aizenstros <daizenstros@quicklogic.com> | ||
3 | Date: Thu, 26 Jul 2012 21:57:12 -0400 | ||
4 | Subject: [PATCH 84/84] beaglebone: cssp_camera driver cleanup | ||
5 | |||
6 | fix v4l2_buf.sequence to use frame count | ||
7 | fix enum/g/s_input functions | ||
8 | remove pointless g/s_std support | ||
9 | change the driver to use dev_err and dev_info instead of printk | ||
10 | |||
11 | Signed-off-by: Dan Aizenstros <daizenstros@quicklogic.com> | ||
12 | Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> | ||
13 | --- | ||
14 | drivers/media/video/cssp_camera/cssp_camera.c | 98 +++++++++++-------------- | ||
15 | drivers/media/video/cssp_camera/cssp_camera.h | 7 +- | ||
16 | 2 files changed, 44 insertions(+), 61 deletions(-) | ||
17 | |||
18 | diff --git a/drivers/media/video/cssp_camera/cssp_camera.c b/drivers/media/video/cssp_camera/cssp_camera.c | ||
19 | index fca199b..4d86bf4 100644 | ||
20 | --- a/drivers/media/video/cssp_camera/cssp_camera.c | ||
21 | +++ b/drivers/media/video/cssp_camera/cssp_camera.c | ||
22 | @@ -51,6 +51,7 @@ | ||
23 | #define PCLK_POL BIT(14) /* PCLK polarity (0 - rising edge, 1 - falling edge */ | ||
24 | #define HS_EN BIT(13) /* High speed bus (0 =< 50 MHz, 1 > 50 MHz) */ | ||
25 | #define ENABLE BIT(12) | ||
26 | +#define REV 0xFF /* Chip Revision mask */ | ||
27 | |||
28 | |||
29 | static struct cssp_cam_fmt formats[] = { | ||
30 | @@ -123,7 +124,7 @@ static int reset_cssp(struct cssp_cam_dev *cam) | ||
31 | |||
32 | err = configure_gpio(cam->reset_pin, 0, "cssp_reset"); | ||
33 | if (err) { | ||
34 | - printk(KERN_ERR "[%s]: failed to configure cssp reset pin\n", pdev->name); | ||
35 | + dev_err(&pdev->dev, "failed to configure cssp reset pin\n"); | ||
36 | return -1; | ||
37 | } | ||
38 | |||
39 | @@ -190,7 +191,6 @@ static void dma_callback(unsigned lch, u16 ch_status, void *data) | ||
40 | |||
41 | if (ch_status == DMA_COMPLETE) { | ||
42 | struct vb2_buffer *vb = dev->current_vb; | ||
43 | - struct timeval ts; | ||
44 | struct edmacc_param dma_tr_params; | ||
45 | |||
46 | edma_read_slot(dev->dma_ch, &dma_tr_params); | ||
47 | @@ -208,13 +208,10 @@ static void dma_callback(unsigned lch, u16 ch_status, void *data) | ||
48 | } | ||
49 | |||
50 | vb->v4l2_buf.field = dev->field; | ||
51 | - dev->field_count++; | ||
52 | - vb->v4l2_buf.sequence = dev->field_count >> 1; | ||
53 | - do_gettimeofday(&ts); | ||
54 | - vb->v4l2_buf.timestamp = ts; | ||
55 | + vb->v4l2_buf.sequence = dev->frame_cnt++; | ||
56 | + do_gettimeofday(&vb->v4l2_buf.timestamp); | ||
57 | vb2_buffer_done(vb, VB2_BUF_STATE_DONE); | ||
58 | dev->current_vb = NULL; | ||
59 | - dev->frame_cnt++; | ||
60 | |||
61 | /* check if we have new buffer queued */ | ||
62 | dequeue_buffer_for_dma(dev); | ||
63 | @@ -237,16 +234,16 @@ static int configure_edma(struct cssp_cam_dev *cam) | ||
64 | pdev->dev.coherent_dma_mask = (u32)~0; | ||
65 | |||
66 | if (dma_set_mask(&pdev->dev, (u32)~0)) { | ||
67 | - printk(KERN_ERR "[%s]: failed setting mask for DMA\n", pdev->name); | ||
68 | + dev_err(&pdev->dev, "failed setting mask for DMA\n"); | ||
69 | return -1; | ||
70 | } | ||
71 | |||
72 | cam->dma_ch = edma_alloc_channel(dma_channel, dma_callback, cam, EVENTQ_0); | ||
73 | if (cam->dma_ch < 0) { | ||
74 | - printk(KERN_ERR "[%s]: allocating channel for DMA failed\n", pdev->name); | ||
75 | + dev_err(&pdev->dev, "allocating channel for DMA failed\n"); | ||
76 | return -EBUSY; | ||
77 | } else { | ||
78 | - printk(KERN_ERR "[%s]: allocating channel for DMA succeeded, chan=%d\n", pdev->name, cam->dma_ch); | ||
79 | + dev_info(&pdev->dev, "allocating channel for DMA succeeded, chan=%d\n", cam->dma_ch); | ||
80 | } | ||
81 | |||
82 | cam->dma_tr_params.opt = TCINTEN | TCC(cam->dma_ch); | ||
83 | @@ -273,7 +270,7 @@ static int configure_cssp(struct cssp_cam_dev *cam) | ||
84 | |||
85 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "gpmc_phys_mem_slot"); | ||
86 | if (res == NULL) { | ||
87 | - printk(KERN_ERR "[%s]: failed to get gpmc_phys_mem_slot resource\n", pdev->name); | ||
88 | + dev_err(&pdev->dev, "failed to get gpmc_phys_mem_slot resource\n"); | ||
89 | return -ENODEV; | ||
90 | } | ||
91 | |||
92 | @@ -289,15 +286,16 @@ static int configure_cssp(struct cssp_cam_dev *cam) | ||
93 | |||
94 | cam->reg_base_virt = (unsigned int)ioremap(cam->reg_base_phys, cam->reg_size); | ||
95 | if (cam->reg_base_virt == 0) { | ||
96 | - printk(KERN_ERR "[%s]: ioremap of registers region failed\n", pdev->name); | ||
97 | + dev_err(&pdev->dev, "ioremap of registers region failed\n"); | ||
98 | release_mem_region(cam->reg_base_phys, cam->reg_size); | ||
99 | return -ENOMEM; | ||
100 | } | ||
101 | |||
102 | - printk(KERN_INFO "[%s]: reg_base_virt = 0x%x\n", pdev->name, cam->reg_base_virt); | ||
103 | + dev_info(&pdev->dev, "reg_base_virt = 0x%x\n", cam->reg_base_virt); | ||
104 | |||
105 | val = readw(cam->reg_base_virt + REG_MODE); | ||
106 | - printk(KERN_INFO "[%s]: reading register address=0x0 returns 0x%x\n", pdev->name, val); | ||
107 | + cam->rev = val & REV; | ||
108 | + dev_info(&pdev->dev, "CSSP Revision %c%d\n", 'A' + ((cam->rev & 0xf0) >> 4), cam->rev & 0x0f); | ||
109 | |||
110 | return 0; | ||
111 | } | ||
112 | @@ -322,7 +320,7 @@ static int configure_camera_sensor(struct cssp_cam_dev *cam) | ||
113 | |||
114 | adapter = i2c_get_adapter(((struct soc_camera_link *)(info->platform_data))->i2c_adapter_id); | ||
115 | if (!adapter) { | ||
116 | - printk(KERN_INFO "[%s]: failed to get adapter...\n", __func__); | ||
117 | + dev_err(&cam->pdev->dev, "failed to get i2c adapter...\n"); | ||
118 | return -ENODEV; | ||
119 | } | ||
120 | |||
121 | @@ -333,7 +331,7 @@ static int configure_camera_sensor(struct cssp_cam_dev *cam) | ||
122 | return -ENODEV; | ||
123 | } | ||
124 | |||
125 | - printk(KERN_INFO "[%s]: client's name is: %s\n", __func__, client->name); | ||
126 | + dev_info(&cam->pdev->dev, "client's name is: %s\n", client->name); | ||
127 | |||
128 | subdev = (struct v4l2_subdev *)i2c_get_clientdata(client); | ||
129 | if (subdev == NULL) { | ||
130 | @@ -417,6 +415,8 @@ static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt, | ||
131 | |||
132 | alloc_ctxs[0] = dev->dma_cont_ctx; | ||
133 | |||
134 | + dev->frame_cnt = 0; | ||
135 | + | ||
136 | dprintk(dev, 1, "%s, count=%d, size=%ld\n", __func__, *nbuffers, size); | ||
137 | |||
138 | return 0; | ||
139 | @@ -659,6 +659,20 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, | ||
140 | pix->bytesperline = (pix->width * fmt->depth) >> 3; | ||
141 | pix->sizeimage = pix->height * pix->bytesperline; | ||
142 | |||
143 | + if ((pix->sizeimage % BYTES_PER_DMA_EVT) != 0) | ||
144 | + return -EINVAL; | ||
145 | + | ||
146 | + switch (mbus_fmt.field) { | ||
147 | + case V4L2_FIELD_ANY: | ||
148 | + pix->field = V4L2_FIELD_NONE; | ||
149 | + break; | ||
150 | + case V4L2_FIELD_NONE: | ||
151 | + break; | ||
152 | + default: | ||
153 | + dev_err(&dev->pdev->dev, "Field type %d unsupported.\n", mbus_fmt.field); | ||
154 | + return -EINVAL; | ||
155 | + } | ||
156 | + | ||
157 | return 0; | ||
158 | } | ||
159 | |||
160 | @@ -744,42 +758,29 @@ static int vidioc_log_status(struct file *file, void *priv) | ||
161 | return 0; | ||
162 | } | ||
163 | |||
164 | -static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *i) | ||
165 | -{ | ||
166 | - return 0; | ||
167 | -} | ||
168 | - | ||
169 | -/* only one input in this sample driver */ | ||
170 | static int vidioc_enum_input(struct file *file, void *priv, | ||
171 | struct v4l2_input *inp) | ||
172 | { | ||
173 | - return -EINVAL; | ||
174 | + if (inp->index > 0) | ||
175 | + return -EINVAL; | ||
176 | |||
177 | inp->type = V4L2_INPUT_TYPE_CAMERA; | ||
178 | - inp->std = V4L2_STD_525_60; | ||
179 | sprintf(inp->name, "Camera %u", inp->index); | ||
180 | + | ||
181 | return 0; | ||
182 | } | ||
183 | |||
184 | static int vidioc_g_input(struct file *file, void *priv, unsigned int *i) | ||
185 | { | ||
186 | - struct cssp_cam_dev *dev = video_drvdata(file); | ||
187 | - | ||
188 | - *i = dev->input; | ||
189 | + *i = 0; | ||
190 | |||
191 | return 0; | ||
192 | } | ||
193 | |||
194 | static int vidioc_s_input(struct file *file, void *priv, unsigned int i) | ||
195 | { | ||
196 | - struct cssp_cam_dev *dev = video_drvdata(file); | ||
197 | - | ||
198 | - return -EINVAL; | ||
199 | - | ||
200 | - if (i == dev->input) | ||
201 | - return 0; | ||
202 | - | ||
203 | - dev->input = i; | ||
204 | + if (i > 0) | ||
205 | + return -EINVAL; | ||
206 | |||
207 | return 0; | ||
208 | } | ||
209 | @@ -805,7 +806,6 @@ static const struct v4l2_ioctl_ops cssp_cam_ioctl_ops = { | ||
210 | .vidioc_querybuf = vidioc_querybuf, | ||
211 | .vidioc_qbuf = vidioc_qbuf, | ||
212 | .vidioc_dqbuf = vidioc_dqbuf, | ||
213 | - .vidioc_s_std = vidioc_s_std, | ||
214 | .vidioc_enum_input = vidioc_enum_input, | ||
215 | .vidioc_g_input = vidioc_g_input, | ||
216 | .vidioc_s_input = vidioc_s_input, | ||
217 | @@ -894,8 +894,6 @@ static struct video_device cssp_cam_template = { | ||
218 | .ioctl_ops = &cssp_cam_ioctl_ops, | ||
219 | .minor = -1, | ||
220 | .release = video_device_release, | ||
221 | - .tvnorms = V4L2_STD_525_60, | ||
222 | - .current_norm = V4L2_STD_NTSC_M, | ||
223 | }; | ||
224 | |||
225 | static int __init video_probe(struct cssp_cam_dev *cam_dev) | ||
226 | @@ -1006,12 +1004,12 @@ static int __init cssp_cam_probe(struct platform_device *pdev) | ||
227 | |||
228 | cssp_cam_platform_data = (struct cssp_cam_platform_data *) pdev->dev.platform_data; | ||
229 | if (cssp_cam_platform_data == NULL) { | ||
230 | - printk(KERN_ERR "[%s]: missing platform data\n", pdev->name); | ||
231 | + dev_err(&pdev->dev, "missing platform data\n"); | ||
232 | return -ENODEV; | ||
233 | } | ||
234 | |||
235 | if (cssp_cam_platform_data->cam_i2c_board_info == NULL) { | ||
236 | - printk(KERN_ERR "[%s]: missing camera i2c board info\n", pdev->name); | ||
237 | + dev_err(&pdev->dev, "missing camera i2c board info\n"); | ||
238 | return -ENODEV; | ||
239 | } | ||
240 | |||
241 | @@ -1027,7 +1025,7 @@ static int __init cssp_cam_probe(struct platform_device *pdev) | ||
242 | cam_dev->camera_clk = clk_get(&pdev->dev, cssp_cam_platform_data->cam_clk_name); | ||
243 | if (IS_ERR(cam_dev->camera_clk)) { | ||
244 | ret = PTR_ERR(cam_dev->camera_clk); | ||
245 | - printk(KERN_ERR "[%s]: cannot clk_get %s\n", pdev->name, cssp_cam_platform_data->cam_clk_name); | ||
246 | + dev_err(&pdev->dev, "cannot clk_get %s\n", cssp_cam_platform_data->cam_clk_name); | ||
247 | goto fail0; | ||
248 | } | ||
249 | |||
250 | @@ -1043,7 +1041,7 @@ static int __init cssp_cam_probe(struct platform_device *pdev) | ||
251 | |||
252 | ret = configure_camera_sensor(cam_dev); | ||
253 | if (ret) { | ||
254 | - printk(KERN_ERR "[%s]: camera sensor configuration failed\n", pdev->name); | ||
255 | + dev_err(&pdev->dev, "camera sensor configuration failed\n"); | ||
256 | goto fail3; | ||
257 | } | ||
258 | |||
259 | @@ -1097,7 +1095,7 @@ static int cssp_cam_remove(struct platform_device *pdev) | ||
260 | |||
261 | kfree(cam); | ||
262 | |||
263 | - printk(KERN_INFO "[%s]: removed\n", pdev->name); | ||
264 | + dev_info(&pdev->dev, "removed\n"); | ||
265 | |||
266 | return 0; | ||
267 | } | ||
268 | @@ -1112,20 +1110,8 @@ static struct platform_driver cssp_cam_driver = { | ||
269 | }, | ||
270 | }; | ||
271 | |||
272 | +module_platform_driver(cssp_cam_driver); | ||
273 | |||
274 | -static int __init cssp_cam_init(void) | ||
275 | -{ | ||
276 | - return platform_driver_register(&cssp_cam_driver); | ||
277 | -} | ||
278 | - | ||
279 | -static void __exit cssp_cam_exit(void) | ||
280 | -{ | ||
281 | - platform_driver_unregister(&cssp_cam_driver); | ||
282 | -} | ||
283 | - | ||
284 | - | ||
285 | -module_init(cssp_cam_init); | ||
286 | -module_exit(cssp_cam_exit); | ||
287 | |||
288 | /* | ||
289 | * Macros sets license, author and description | ||
290 | diff --git a/drivers/media/video/cssp_camera/cssp_camera.h b/drivers/media/video/cssp_camera/cssp_camera.h | ||
291 | index 8eb5f83..3bb6ea4 100644 | ||
292 | --- a/drivers/media/video/cssp_camera/cssp_camera.h | ||
293 | +++ b/drivers/media/video/cssp_camera/cssp_camera.h | ||
294 | @@ -111,9 +111,6 @@ struct cssp_cam_dev { | ||
295 | int streaming_started; | ||
296 | struct vb2_buffer *current_vb; | ||
297 | |||
298 | - /* Input Number */ | ||
299 | - int input; | ||
300 | - | ||
301 | /* video capture */ | ||
302 | struct cssp_cam_fmt *fmt; | ||
303 | u32 width; | ||
304 | @@ -123,8 +120,6 @@ struct cssp_cam_dev { | ||
305 | enum v4l2_colorspace colorspace; | ||
306 | struct vb2_queue vb_vidq; | ||
307 | enum v4l2_field field; | ||
308 | - unsigned int field_count; | ||
309 | - | ||
310 | |||
311 | /* Camera Sensor */ | ||
312 | struct i2c_board_info *camera_board_info; | ||
313 | @@ -142,6 +137,8 @@ struct cssp_cam_dev { | ||
314 | int frame_cnt; | ||
315 | |||
316 | int reset_pin; | ||
317 | + | ||
318 | + int rev; | ||
319 | }; | ||
320 | |||
321 | |||
322 | -- | ||
323 | 1.7.7.6 | ||
324 | |||