diff options
52 files changed, 4159 insertions, 50 deletions
diff --git a/Documentation/devicetree/bindings/hwlock/hwspinlock-user.txt b/Documentation/devicetree/bindings/hwlock/hwspinlock-user.txt new file mode 100644 index 000000000000..0e5ab1e0b952 --- /dev/null +++ b/Documentation/devicetree/bindings/hwlock/hwspinlock-user.txt | |||
@@ -0,0 +1,20 @@ | |||
1 | Hardware spinlock user-space interface | ||
2 | ====================================== | ||
3 | |||
4 | A hwspinlock client that provides ioctls to lock and unlock the | ||
5 | reserved hwlocks. | ||
6 | |||
7 | Required properties: | ||
8 | - compatible: Should be "hwspinlock-user" | ||
9 | - hwlocks: An array of the phandle and hwlock number | ||
10 | specifier tuple | ||
11 | |||
12 | Example: | ||
13 | |||
14 | gatemp { | ||
15 | compatible = "hwspinlock-user"; | ||
16 | hwlocks = <&hwspinlock 0>, | ||
17 | <&hwspinlock 1>, | ||
18 | <&hwspinlock 2>, | ||
19 | <&hwspinlock 3>; | ||
20 | }; | ||
diff --git a/Documentation/devicetree/bindings/media/i2c/tvp5158.txt b/Documentation/devicetree/bindings/media/i2c/tvp5158.txt new file mode 100644 index 000000000000..833dbcda1590 --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/tvp5158.txt | |||
@@ -0,0 +1,34 @@ | |||
1 | * Texas Instruments TVP5158 video decoder | ||
2 | |||
3 | The TVP5158 device is high quality, single-chip | ||
4 | digital video decoder that digitizes and decodes all popular baseband analog | ||
5 | video formats into digital video component. The tvp5158 decoder supports | ||
6 | decoding of NTSC, PAL and SECAM composite and S-video. | ||
7 | |||
8 | TVP5158 generates output in BT656 format with embedded sync. | ||
9 | |||
10 | Required Properties : | ||
11 | - compatible : Must be "ti,tvp5158" | ||
12 | |||
13 | Optional Properties : | ||
14 | There are no custom optional properties although the driver supports | ||
15 | standard endpoint properties as documented in | ||
16 | Documentation/devicetree/bindings/media/video-interfaces.txt | ||
17 | |||
18 | Example: | ||
19 | |||
20 | &i2c2 { | ||
21 | ... | ||
22 | ... | ||
23 | tvp5158@5c { | ||
24 | compatible = "ti,tvp5158"; | ||
25 | reg = <0x58>; | ||
26 | |||
27 | port { | ||
28 | tvp_decoder: endpoint { | ||
29 | /* No properties for BT 656 */ | ||
30 | }; | ||
31 | }; | ||
32 | }; | ||
33 | ... | ||
34 | }; | ||
diff --git a/Documentation/devicetree/bindings/sound/codecs.txt b/Documentation/devicetree/bindings/sound/codecs.txt new file mode 100644 index 000000000000..8e6630d73fee --- /dev/null +++ b/Documentation/devicetree/bindings/sound/codecs.txt | |||
@@ -0,0 +1,7 @@ | |||
1 | Codecs: | ||
2 | |||
3 | Generic properties for any audio codec handled directly by ASoC core. | ||
4 | |||
5 | Optional properties: | ||
6 | - name-prefix : Name prefix to avoid kcontrol name collisions | ||
7 | in cards with multiple instances of the same codec | ||
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index 46bc9829c71a..00107789a6dd 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt | |||
@@ -39,6 +39,8 @@ Optional properties: | |||
39 | please refer to pinctrl-bindings.txt | 39 | please refer to pinctrl-bindings.txt |
40 | - fck_parent : Should contain a valid clock name which will be used as parent | 40 | - fck_parent : Should contain a valid clock name which will be used as parent |
41 | for the McASP fck | 41 | for the McASP fck |
42 | - shared-dai : CPU DAI is shared (typically shared with DSP). McASP will not be | ||
43 | power managed at runtime. | ||
42 | 44 | ||
43 | Example: | 45 | Example: |
44 | 46 | ||
diff --git a/Documentation/devicetree/bindings/video/fpd3-serdes.txt b/Documentation/devicetree/bindings/video/fpd3-serdes.txt new file mode 100644 index 000000000000..e2afceeafacb --- /dev/null +++ b/Documentation/devicetree/bindings/video/fpd3-serdes.txt | |||
@@ -0,0 +1,132 @@ | |||
1 | Texas instruments video serializer de serializer | ||
2 | ================================================ | ||
3 | |||
4 | See Documentation/video-serdes.txt for generic information about | ||
5 | video serializer / de serializers. | ||
6 | |||
7 | FPDlink3 video serdes devices are I2C slave devices. They are always | ||
8 | used in pairs where one device is connected to the CPU/SoC which is | ||
9 | called local device and the other one is called remote device. | ||
10 | |||
11 | FPDlink3 video serdes devices have some gpios which can be controlled | ||
12 | over I2C. Also, the FPDlink supports gpio forwarding. Which means that | ||
13 | the remote device can copy the gpio values from it's remote device. | ||
14 | |||
15 | Also, each of the remote device is an I2C master itself, so it can | ||
16 | interface some I2C slaves at remote end. For e.g, a backlight LCD chip | ||
17 | connected to the de serializer or the camera connected to a serializer. | ||
18 | So these slaves can be accessed from local devices via I2C aliases. | ||
19 | |||
20 | A pair of serializer/deserializer can be used for tunneling the i2c | ||
21 | transactions over LVDS channel. The one of the device is connected to | ||
22 | the system i2c bus in slave mode and the other one acts as a master | ||
23 | at the remote end. But, the slave device can register dummy aliases | ||
24 | remote master and for each of the remote slaves. | ||
25 | As this is acting like a i2c bridge driver, we need a method for | ||
26 | configuring the address translations. | ||
27 | |||
28 | Required Properties: | ||
29 | |||
30 | - compatible: should be one of the following. | ||
31 | - "ti,ds90ub913aq": For TI FPDlink3 12bit video serializer | ||
32 | - "ti,ds90ub914aq": For TI FPDlink3 12bit video de serializer | ||
33 | - "ti,ds90uh925q": For TI FPDlink3 24bit video serializer | ||
34 | - "ti,ds90uh928q": For TI FPDlink3 24bit video de serializer | ||
35 | |||
36 | - reg: I2C slave address | ||
37 | This would be the alias adress for remote device. The CPU side | ||
38 | ser/des would address the remote device using this address. | ||
39 | |||
40 | Optional Properties: | ||
41 | |||
42 | - gpio-controller: Marks the device node as a gpio controller. | ||
43 | - #gpio-cells: Should be 1. The first cell is the GPIO number. | ||
44 | |||
45 | - ranges: This is the address translation table for mapping i2c devices | ||
46 | on the remote bus to the i2c address(alias) on parent bus. | ||
47 | The first entry in the ranges property has to of the corresponding | ||
48 | remote ser/des device. | ||
49 | For dynamic address mapping, keep the remote slave address as 0x0 | ||
50 | The corresponding alias would be used if the remote slave doesn't | ||
51 | have an address already mapped. | ||
52 | |||
53 | - slave-mode: This property marks the ser/des as remote device. | ||
54 | For a device where 'slave-mode' property is absent, it is considered | ||
55 | as master device and 'ranges' and 'i2c-bus-num' properties are | ||
56 | compulsory. | ||
57 | |||
58 | Example: | ||
59 | |||
60 | Following example demonstrates device node structure for a camera connected | ||
61 | using FPDlink3 ser/des. Here the deserializer and serializer are connected | ||
62 | only via the LVDS link. The camera is connected on the serializer i2c bus. | ||
63 | Here, serializer and camera are not connected to the system i2c bus, but it | ||
64 | can be accessed from the system i2c bus. The deserializer maps each of the | ||
65 | remote slave onto the system i2c bus and acts as a bridge to transfer any | ||
66 | messages addressed to the remote devices. | ||
67 | |||
68 | ======================================= | ||
69 | +-------+ | ||
70 | |I2C bus| | ||
71 | +-------+ | ||
72 | | | ||
73 | |0x60<real> +------------+ | ||
74 | +-----------|Deserializer|0x60 | ||
75 | | +------------+ | ||
76 | | X | ||
77 | | X | ||
78 | | X <LVDS link> | ||
79 | | X | ||
80 | | X | ||
81 | | +----------+ | ||
82 | | | Remote | | ||
83 | | | i2c bus | | ||
84 | | +----------+ | ||
85 | | | | ||
86 | |0x74<alias> | +----------+ | ||
87 | | <- - - - +------|Serializer| 0x58 | ||
88 | | | +----------+ | ||
89 | | | | ||
90 | |0x38<alias> | +---------+ | ||
91 | | <- - - - +------|OV Camera| 0x30 | ||
92 | | | +---------+ | ||
93 | | | ||
94 | | | ||
95 | ======================================= | ||
96 | |||
97 | i2cbus { | ||
98 | lvds_des: deserializer@60 { | ||
99 | compatible = "ti,ds90ub914aq"; | ||
100 | reg = <0x60>; | ||
101 | |||
102 | gpio-controller; | ||
103 | #gpio-cells=1; | ||
104 | |||
105 | i2c-bus-num = <5>; | ||
106 | }; | ||
107 | }; | ||
108 | |||
109 | &lvds_des { | ||
110 | |||
111 | ranges = <0x58 0x74>, | ||
112 | <0x38 0x30>; | ||
113 | |||
114 | lvds_ser: serializer@58 { | ||
115 | compatible = "ti,ds90ub913aq"; | ||
116 | reg = <0x58>; | ||
117 | remote-device = <&lvds_des>; | ||
118 | |||
119 | gpio-controller; | ||
120 | #gpio-cells=1; | ||
121 | |||
122 | slave-mode; | ||
123 | }; | ||
124 | |||
125 | lvds_cam: camera@30 { | ||
126 | compatible = "ov10635" | ||
127 | reg = <0x30>; | ||
128 | |||
129 | gpios = <&lvds_ser 0>; | ||
130 | /* power pin controlled by serializer local gpio */ | ||
131 | }; | ||
132 | }; | ||
diff --git a/Documentation/video-serdes.txt b/Documentation/video-serdes.txt new file mode 100644 index 000000000000..d74da285b518 --- /dev/null +++ b/Documentation/video-serdes.txt | |||
@@ -0,0 +1,42 @@ | |||
1 | Video serializer and de serializer | ||
2 | ================================== | ||
3 | |||
4 | Video serializers and de serializers are the devices which are used to | ||
5 | interface parallel port video imaging or display devices using serial | ||
6 | medium. | ||
7 | |||
8 | Video serializer are used at the transmit side to convert the parallel data | ||
9 | and the control signals to serial data and send it at high frequency | ||
10 | using fewer cables. | ||
11 | Video de serializer are used at the receive side to convert the serial data | ||
12 | into parallel port video and recreate the same control signals. | ||
13 | |||
14 | Typical video serializer/de serializer (serdes) uses data lines as well as | ||
15 | pixel clock, hsync, vsync, etc. | ||
16 | |||
17 | The video serdes devices are controlled via I2C interface and they are always | ||
18 | used in pairs. One end is connected to the video peripheral and other is | ||
19 | connected to the CPU/ SoC. In this way, only one of the device is actually | ||
20 | connected to the I2C bus while other device is controllable remotely. | ||
21 | |||
22 | In case of camera, serializer and camera are remotely connected to the | ||
23 | system and are controllable via deserializer. | ||
24 | First, the deserializer needs to be configured before accessing the | ||
25 | serialzer or the camera. | ||
26 | |||
27 | In case of display, de serializer and display are remotely connected to the | ||
28 | system and are controllable via serializer. | ||
29 | First, the serializer needs to be configured before accessing the | ||
30 | deserializer of the display. | ||
31 | |||
32 | When serdes devices are to be controlled remotely, the device which is | ||
33 | connected to the system registers it's counterpart as an alias. | ||
34 | So that all the accesses done to the alias are reproduced at the remote end. | ||
35 | |||
36 | |||
37 | Linux kernel has driver support for following video devices: | ||
38 | =========================================================== | ||
39 | |||
40 | "drivers/video/serdes/fpd3_serdes.c" supports video (de)serializers. | ||
41 | See Documentation/devicetree/bindings/video/fpd3-serdes.txt | ||
42 | for more information on the devices supported and the device tree bindings | ||
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index c870b120ab1b..d4602ec10dbf 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile | |||
@@ -496,6 +496,7 @@ dtb-$(CONFIG_SOC_DRA7XX) += \ | |||
496 | dra7-evm-lcd-lg.dtb \ | 496 | dra7-evm-lcd-lg.dtb \ |
497 | dra7-evm-lcd-osd.dtb \ | 497 | dra7-evm-lcd-osd.dtb \ |
498 | dra7-evm-lcd-osd101t2587.dtb \ | 498 | dra7-evm-lcd-osd101t2587.dtb \ |
499 | dra7-evm-vision.dtb \ | ||
499 | am57xx-beagle-x15.dtb \ | 500 | am57xx-beagle-x15.dtb \ |
500 | am57xx-beagle-x15-revb1.dtb \ | 501 | am57xx-beagle-x15-revb1.dtb \ |
501 | am571x-idk.dtb \ | 502 | am571x-idk.dtb \ |
@@ -513,6 +514,7 @@ dtb-$(CONFIG_SOC_DRA7XX) += \ | |||
513 | dra72-evm-revc.dtb \ | 514 | dra72-evm-revc.dtb \ |
514 | dra72-evm-revc-lcd-osd101t2045.dtb \ | 515 | dra72-evm-revc-lcd-osd101t2045.dtb \ |
515 | dra72-evm-revc-lcd-osd101t2587.dtb \ | 516 | dra72-evm-revc-lcd-osd101t2587.dtb \ |
517 | dra72-evm-vision.dtb \ | ||
516 | dra71-evm.dtb \ | 518 | dra71-evm.dtb \ |
517 | dra71-evm-lcd-auo-g101evn01.0.dtb \ | 519 | dra71-evm-lcd-auo-g101evn01.0.dtb \ |
518 | dra76-evm.dtb \ | 520 | dra76-evm.dtb \ |
diff --git a/arch/arm/boot/dts/dra7-evm-common.dtsi b/arch/arm/boot/dts/dra7-evm-common.dtsi index 15612602d502..8ea4d57a6d3b 100644 --- a/arch/arm/boot/dts/dra7-evm-common.dtsi +++ b/arch/arm/boot/dts/dra7-evm-common.dtsi | |||
@@ -46,7 +46,7 @@ | |||
46 | 46 | ||
47 | sound0_master: simple-audio-card,cpu { | 47 | sound0_master: simple-audio-card,cpu { |
48 | sound-dai = <&mcasp3>; | 48 | sound-dai = <&mcasp3>; |
49 | system-clock-frequency = <5644800>; | 49 | system-clock-frequency = <11289600>; |
50 | }; | 50 | }; |
51 | 51 | ||
52 | simple-audio-card,codec { | 52 | simple-audio-card,codec { |
@@ -242,9 +242,11 @@ | |||
242 | <&atl_gfclk_mux>, | 242 | <&atl_gfclk_mux>, |
243 | <&dpll_abe_ck>, | 243 | <&dpll_abe_ck>, |
244 | <&dpll_abe_m2x2_ck>, | 244 | <&dpll_abe_m2x2_ck>, |
245 | <&atl_clkin1_ck>, | ||
245 | <&atl_clkin2_ck>; | 246 | <&atl_clkin2_ck>; |
246 | assigned-clock-parents = <&sys_clkin2>, <&dpll_abe_m2_ck>; | 247 | assigned-clock-parents = <&sys_clkin2>, <&dpll_abe_m2_ck>; |
247 | assigned-clock-rates = <0>, <0>, <180633600>, <361267200>, <5644800>; | 248 | assigned-clock-rates = <0>, <0>, <180633600>, <361267200>, |
249 | <11289600>, <11289600>; | ||
248 | 250 | ||
249 | status = "okay"; | 251 | status = "okay"; |
250 | 252 | ||
diff --git a/arch/arm/boot/dts/dra7-evm-lcd-lg.dts b/arch/arm/boot/dts/dra7-evm-lcd-lg.dts index d2653938d051..f67beaa8ff01 100644 --- a/arch/arm/boot/dts/dra7-evm-lcd-lg.dts +++ b/arch/arm/boot/dts/dra7-evm-lcd-lg.dts | |||
@@ -8,3 +8,9 @@ | |||
8 | 8 | ||
9 | #include "dra7-evm.dts" | 9 | #include "dra7-evm.dts" |
10 | #include "dra7x-evm-lcd-lg.dtsi" | 10 | #include "dra7x-evm-lcd-lg.dtsi" |
11 | |||
12 | &ldc3001 { | ||
13 | interrupt-parent = <&gpio1>; | ||
14 | interrupts = <2 IRQ_TYPE_LEVEL_HIGH>; | ||
15 | }; | ||
16 | |||
diff --git a/arch/arm/boot/dts/dra7-evm-vision.dts b/arch/arm/boot/dts/dra7-evm-vision.dts new file mode 100644 index 000000000000..10c96d156887 --- /dev/null +++ b/arch/arm/boot/dts/dra7-evm-vision.dts | |||
@@ -0,0 +1,127 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/ | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #include "dra7-evm.dts" | ||
10 | |||
11 | i2cexp: &i2c2 { | ||
12 | }; | ||
13 | |||
14 | #include "dra7xx-vision.dtsi" | ||
15 | |||
16 | /* | ||
17 | * Following is the mapping of the cameras and video ports: | ||
18 | * | ||
19 | * +--------+---------+---------+---------+---------+ | ||
20 | * | LVDS | DES I2C | Remote | SER I2C | CAM I2C | | ||
21 | * | Camera | Addr | I2C bus | Alias | Alias | | ||
22 | * +--------+---------+---------+---------+---------+ | ||
23 | * | cam1 | 0x60 | 11 | 0x74 | 0x38 | | ||
24 | * | cam2 | 0x64 | 12 | 0x75 | 0x39 | | ||
25 | * | cam3 | 0x68 | 13 | 0x76 | 0x3A | | ||
26 | * | cam4 | 0x6C | 14 | 0x77 | 0x3B | | ||
27 | * | cam5 | 0x69 | 15 | 0x78 | 0x3C | | ||
28 | * | cam6 | 0x61 | 16 | 0x79 | 0x3D | | ||
29 | * +--------+---------+---------+---------+---------+ | ||
30 | * | ||
31 | * For easier access, all the remote devices can be accessed using the | ||
32 | * remote bus as well as the local bus. e.g. remote Serializer can be | ||
33 | * accessed as 11-0058 as well as 1-0074 | ||
34 | */ | ||
35 | &vip1 { | ||
36 | status = "okay"; | ||
37 | }; | ||
38 | |||
39 | &vip2 { | ||
40 | status = "okay"; | ||
41 | }; | ||
42 | |||
43 | &vip3 { | ||
44 | status = "okay"; | ||
45 | }; | ||
46 | |||
47 | &ovcam_fc { | ||
48 | /* Select between onboard OV10633 camera and daughter card vin | ||
49 | * Also enable power for the OVcamera externally | ||
50 | */ | ||
51 | mux-gpios = | ||
52 | <&pcf_hdmi 3 GPIO_ACTIVE_HIGH>, /* CAM_FPD_MUX_S0 */ | ||
53 | <&gpio6 17 GPIO_ACTIVE_HIGH>; /* OV_PWDN */ | ||
54 | }; | ||
55 | |||
56 | &ovcam1 { | ||
57 | /* Select between onboard OV10633 camera and daughter card vin */ | ||
58 | mux-gpios = | ||
59 | <&pcf_hdmi 3 GPIO_ACTIVE_HIGH>; /* CAM_FPD_MUX_S0 */ | ||
60 | }; | ||
61 | |||
62 | &ovcam2 { | ||
63 | /* Select between vin2a and ethernet slave0 */ | ||
64 | mux-gpios = | ||
65 | <&pcf_hdmi 2 GPIO_ACTIVE_LOW>; /* VIN2_S0 */ | ||
66 | }; | ||
67 | |||
68 | &ovcam3 { | ||
69 | /* No board muxes */ | ||
70 | }; | ||
71 | |||
72 | &ovcam4 { | ||
73 | /* No board muxes */ | ||
74 | }; | ||
75 | |||
76 | &ovcam5 { | ||
77 | /* No board muxes */ | ||
78 | }; | ||
79 | |||
80 | &ovcam6 { | ||
81 | mux-gpios = | ||
82 | <&pcf_hdmi 1 GPIO_ACTIVE_HIGH>; /* VIN6_SEL_S0 */ | ||
83 | }; | ||
84 | |||
85 | &vin1a { | ||
86 | status = "okay"; | ||
87 | endpoint@cam1 { | ||
88 | slave-mode; | ||
89 | remote-endpoint = <&cam1>; | ||
90 | }; | ||
91 | endpoint@ovcam { | ||
92 | slave-mode; | ||
93 | remote-endpoint = <&ovcam>; | ||
94 | }; | ||
95 | }; | ||
96 | |||
97 | &vin2a { | ||
98 | status = "okay"; | ||
99 | endpoint@0 { | ||
100 | slave-mode; | ||
101 | remote-endpoint = <&cam2>; | ||
102 | }; | ||
103 | }; | ||
104 | |||
105 | &vin3a { | ||
106 | status = "okay"; | ||
107 | endpoint@0 { | ||
108 | slave-mode; | ||
109 | remote-endpoint = <&cam3>; | ||
110 | }; | ||
111 | }; | ||
112 | |||
113 | &vin5a { | ||
114 | status = "okay"; | ||
115 | endpoint@0 { | ||
116 | slave-mode; | ||
117 | remote-endpoint = <&cam4>; | ||
118 | }; | ||
119 | }; | ||
120 | |||
121 | &vin6a { | ||
122 | status = "okay"; | ||
123 | endpoint@0 { | ||
124 | slave-mode; | ||
125 | remote-endpoint = <&cam6>; | ||
126 | }; | ||
127 | }; | ||
diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts index e98cd713306b..eab47e32b2fa 100644 --- a/arch/arm/boot/dts/dra7-evm.dts +++ b/arch/arm/boot/dts/dra7-evm.dts | |||
@@ -19,7 +19,7 @@ | |||
19 | reg = <0x0 0x80000000 0x0 0x60000000>; /* 1536 MB */ | 19 | reg = <0x0 0x80000000 0x0 0x60000000>; /* 1536 MB */ |
20 | }; | 20 | }; |
21 | 21 | ||
22 | reserved-memory { | 22 | reserved_mem: reserved-memory { |
23 | #address-cells = <2>; | 23 | #address-cells = <2>; |
24 | #size-cells = <2>; | 24 | #size-cells = <2>; |
25 | ranges; | 25 | ranges; |
@@ -53,6 +53,11 @@ | |||
53 | }; | 53 | }; |
54 | }; | 54 | }; |
55 | 55 | ||
56 | aliases { | ||
57 | display1 = &fpd_disp; | ||
58 | i2c7 = &disp_ser; | ||
59 | }; | ||
60 | |||
56 | evm_1v8_sw: fixedregulator-evm_1v8 { | 61 | evm_1v8_sw: fixedregulator-evm_1v8 { |
57 | compatible = "regulator-fixed"; | 62 | compatible = "regulator-fixed"; |
58 | regulator-name = "evm_1v8"; | 63 | regulator-name = "evm_1v8"; |
@@ -820,7 +825,7 @@ | |||
820 | }; | 825 | }; |
821 | }; | 826 | }; |
822 | 827 | ||
823 | &i2c2 { | 828 | i2c_p3_exp: &i2c2 { |
824 | status = "okay"; | 829 | status = "okay"; |
825 | clock-frequency = <400000>; | 830 | clock-frequency = <400000>; |
826 | 831 | ||
@@ -852,6 +857,37 @@ | |||
852 | }; | 857 | }; |
853 | }; | 858 | }; |
854 | }; | 859 | }; |
860 | |||
861 | disp_ser: serializer@1b { | ||
862 | compatible = "ti,ds90uh925q"; | ||
863 | reg = <0x1b>; | ||
864 | |||
865 | #address-cells = <1>; | ||
866 | #size-cells = <0>; | ||
867 | ranges = <0x2c 0x2c>, | ||
868 | <0x1c 0x1c>; | ||
869 | |||
870 | disp_des: deserializer@2c { | ||
871 | compatible = "ti,ds90uh928q"; | ||
872 | reg = <0x2c>; | ||
873 | slave-mode; | ||
874 | }; | ||
875 | |||
876 | /* TLC chip for LCD panel power and backlight */ | ||
877 | fpd_disp: tlc59108@1c { | ||
878 | status = "disabled"; | ||
879 | reg = <0x1c>; | ||
880 | compatible = "ti,tlc59108-fpddisp"; | ||
881 | enable-gpios = <&pcf_gpio_21 0 GPIO_ACTIVE_LOW>; | ||
882 | /* P0, SEL_GPMC_AD_VID_S0 */ | ||
883 | |||
884 | port@lcd3 { | ||
885 | fpd_in: endpoint { | ||
886 | remote-endpoint = <&dpi_out3>; | ||
887 | }; | ||
888 | }; | ||
889 | }; | ||
890 | }; | ||
855 | }; | 891 | }; |
856 | 892 | ||
857 | &mmc1 { | 893 | &mmc1 { |
@@ -1144,9 +1180,24 @@ | |||
1144 | }; | 1180 | }; |
1145 | 1181 | ||
1146 | &dss { | 1182 | &dss { |
1147 | status = "ok"; | 1183 | status = "okay"; |
1148 | 1184 | ||
1149 | vdda_video-supply = <&ldoln_reg>; | 1185 | vdda_video-supply = <&ldoln_reg>; |
1186 | |||
1187 | ports { | ||
1188 | #address-cells = <1>; | ||
1189 | #size-cells = <0>; | ||
1190 | status = "disabled"; | ||
1191 | |||
1192 | port@lcd3 { | ||
1193 | reg = <2>; | ||
1194 | |||
1195 | dpi_out3: endpoint { | ||
1196 | remote-endpoint = <&fpd_in>; | ||
1197 | data-lines = <24>; | ||
1198 | }; | ||
1199 | }; | ||
1200 | }; | ||
1150 | }; | 1201 | }; |
1151 | 1202 | ||
1152 | &hdmi { | 1203 | &hdmi { |
@@ -1158,7 +1209,7 @@ | |||
1158 | status = "okay"; | 1209 | status = "okay"; |
1159 | }; | 1210 | }; |
1160 | 1211 | ||
1161 | &vin1a { | 1212 | video_in: &vin1a { |
1162 | status = "okay"; | 1213 | status = "okay"; |
1163 | endpoint@0 { | 1214 | endpoint@0 { |
1164 | slave-mode; | 1215 | slave-mode; |
@@ -1170,3 +1221,8 @@ | |||
1170 | status = "okay"; | 1221 | status = "okay"; |
1171 | }; | 1222 | }; |
1172 | 1223 | ||
1224 | #include "dra7xx-jamr3.dtsi" | ||
1225 | &tvp_5158{ | ||
1226 | mux-gpios = <&pcf_hdmi 3 GPIO_ACTIVE_HIGH>, /*CAM_FPD_MUX_S0*/ | ||
1227 | <&pcf_jamr3_21 8 GPIO_ACTIVE_LOW>; /*SEL_TVP_FPD*/ | ||
1228 | }; | ||
diff --git a/arch/arm/boot/dts/dra72-evm-common.dtsi b/arch/arm/boot/dts/dra72-evm-common.dtsi index f914e6ac0256..b3a93c35ba7c 100644 --- a/arch/arm/boot/dts/dra72-evm-common.dtsi +++ b/arch/arm/boot/dts/dra72-evm-common.dtsi | |||
@@ -16,9 +16,10 @@ | |||
16 | 16 | ||
17 | aliases { | 17 | aliases { |
18 | display0 = &hdmi0; | 18 | display0 = &hdmi0; |
19 | 19 | display1 = &fpd_disp; | |
20 | sound0 = &sound0; | 20 | sound0 = &snd0; |
21 | sound1 = &hdmi; | 21 | sound1 = &hdmi; |
22 | i2c7 = &disp_ser; | ||
22 | }; | 23 | }; |
23 | 24 | ||
24 | evm_12v0: fixedregulator-evm12v0 { | 25 | evm_12v0: fixedregulator-evm12v0 { |
@@ -137,7 +138,7 @@ | |||
137 | }; | 138 | }; |
138 | }; | 139 | }; |
139 | 140 | ||
140 | sound0: sound@0 { | 141 | snd0: sound@0 { |
141 | compatible = "simple-audio-card"; | 142 | compatible = "simple-audio-card"; |
142 | simple-audio-card,name = "DRA7xx-EVM"; | 143 | simple-audio-card,name = "DRA7xx-EVM"; |
143 | simple-audio-card,widgets = | 144 | simple-audio-card,widgets = |
@@ -162,7 +163,7 @@ | |||
162 | 163 | ||
163 | sound0_master: simple-audio-card,cpu { | 164 | sound0_master: simple-audio-card,cpu { |
164 | sound-dai = <&mcasp3>; | 165 | sound-dai = <&mcasp3>; |
165 | system-clock-frequency = <5644800>; | 166 | system-clock-frequency = <11289600>; |
166 | }; | 167 | }; |
167 | 168 | ||
168 | simple-audio-card,codec { | 169 | simple-audio-card,codec { |
@@ -282,7 +283,7 @@ | |||
282 | }; | 283 | }; |
283 | }; | 284 | }; |
284 | 285 | ||
285 | &i2c5 { | 286 | i2c_p3_exp: &i2c5 { |
286 | status = "okay"; | 287 | status = "okay"; |
287 | clock-frequency = <400000>; | 288 | clock-frequency = <400000>; |
288 | 289 | ||
@@ -582,8 +583,56 @@ | |||
582 | }; | 583 | }; |
583 | }; | 584 | }; |
584 | 585 | ||
586 | &i2c5 { | ||
587 | disp_ser: serializer@1b { | ||
588 | compatible = "ti,ds90uh925q"; | ||
589 | reg = <0x1b>; | ||
590 | |||
591 | #address-cells = <1>; | ||
592 | #size-cells = <0>; | ||
593 | ranges = <0x2c 0x2c>, | ||
594 | <0x1c 0x1c>; | ||
595 | |||
596 | disp_des: deserializer@2c { | ||
597 | compatible = "ti,ds90uh928q"; | ||
598 | reg = <0x2c>; | ||
599 | slave-mode; | ||
600 | }; | ||
601 | |||
602 | /* TLC chip for LCD panel power and backlight */ | ||
603 | fpd_disp: tlc59108@1c { | ||
604 | status = "disabled"; | ||
605 | reg = <0x1c>; | ||
606 | compatible = "ti,tlc59108-fpddisp"; | ||
607 | enable-gpios = <&pcf_gpio_21 0 GPIO_ACTIVE_LOW>; | ||
608 | /* P0, SEL_GPMC_AD_VID_S0 */ | ||
609 | |||
610 | port@lcd3 { | ||
611 | fpd_in: endpoint { | ||
612 | remote-endpoint = <&dpi_out3>; | ||
613 | }; | ||
614 | }; | ||
615 | }; | ||
616 | }; | ||
617 | }; | ||
618 | |||
585 | &dss { | 619 | &dss { |
586 | status = "ok"; | 620 | status = "ok"; |
621 | vdda_video-supply = <&ldo5_reg>; | ||
622 | ports { | ||
623 | #address-cells = <1>; | ||
624 | #size-cells = <0>; | ||
625 | status = "disabled"; | ||
626 | |||
627 | port@lcd3 { | ||
628 | reg = <2>; | ||
629 | |||
630 | dpi_out3: endpoint { | ||
631 | remote-endpoint = <&fpd_in>; | ||
632 | data-lines = <24>; | ||
633 | }; | ||
634 | }; | ||
635 | }; | ||
587 | }; | 636 | }; |
588 | 637 | ||
589 | &bb2d { | 638 | &bb2d { |
@@ -628,9 +677,11 @@ | |||
628 | <&atl_gfclk_mux>, | 677 | <&atl_gfclk_mux>, |
629 | <&dpll_abe_ck>, | 678 | <&dpll_abe_ck>, |
630 | <&dpll_abe_m2x2_ck>, | 679 | <&dpll_abe_m2x2_ck>, |
680 | <&atl_clkin1_ck>, | ||
631 | <&atl_clkin2_ck>; | 681 | <&atl_clkin2_ck>; |
632 | assigned-clock-parents = <&sys_clkin2>, <&dpll_abe_m2_ck>; | 682 | assigned-clock-parents = <&sys_clkin2>, <&dpll_abe_m2_ck>; |
633 | assigned-clock-rates = <0>, <0>, <180633600>, <361267200>, <5644800>; | 683 | assigned-clock-rates = <0>, <0>, <180633600>, <361267200>, |
684 | <11289600>, <11289600>; | ||
634 | 685 | ||
635 | status = "okay"; | 686 | status = "okay"; |
636 | 687 | ||
diff --git a/arch/arm/boot/dts/dra72-evm-vision.dts b/arch/arm/boot/dts/dra72-evm-vision.dts new file mode 100644 index 000000000000..98b1b1646064 --- /dev/null +++ b/arch/arm/boot/dts/dra72-evm-vision.dts | |||
@@ -0,0 +1,139 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/ | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #include "dra72-evm.dts" | ||
10 | |||
11 | i2cexp: &i2c5 { | ||
12 | }; | ||
13 | |||
14 | #include "dra7xx-vision.dtsi" | ||
15 | |||
16 | /* | ||
17 | * Following is the mapping of the cameras and video ports: | ||
18 | * This is for the RevC onwards of DRA72 EVMs | ||
19 | * | ||
20 | * +-------+--------+---------+---------+---------+---------+ | ||
21 | * | Video | LVDS | DES I2C | Remote | SER I2C | CAM I2C | | ||
22 | * | Port | Camera | Addr | I2C bus | Alias | Alias | | ||
23 | * +-------+--------+---------+---------+---------+---------+ | ||
24 | * | vin1a | cam2 | 0x64 | 12 | 0x75 | 0x39 | | ||
25 | * | vin1b | cam5 | 0x69 | 15 | 0x78 | 0x3C | | ||
26 | * | vin2a | cam1 | 0x60 | 11 | 0x74 | 0x38 | | ||
27 | * | vin2b | cam4 | 0x6C | 14 | 0x77 | 0x3B | | ||
28 | * +-------+--------+---------+---------+---------+---------+ | ||
29 | * | ||
30 | * For easier access, all the remote devices can be accessed using the | ||
31 | * remote bus as well as the local bus. e.g. remote Serializer can be | ||
32 | * accessed as 11-0058 as well as 4-0074 | ||
33 | */ | ||
34 | |||
35 | &dra72_vip_mux { | ||
36 | |||
37 | pinctrl-names = "default"; | ||
38 | pinctrl-0 = <&vip_mux>; | ||
39 | |||
40 | /* Following is the mapping of interfaces | ||
41 | * vin1A <= vin3A (remapped) | ||
42 | * vin1B <= vin4B (remapped, only available option) | ||
43 | * vin2A <= vin2A (default) | ||
44 | * vin2B <= vin2B (default) | ||
45 | */ | ||
46 | vip_mux: pinmux_vin5a_pins { | ||
47 | pinctrl-single,pins = < | ||
48 | 0x0 (VIP_VIN3A | VIP_VIN4B | VIP_VIN2A | VIP_VIN2B) | ||
49 | >; | ||
50 | }; | ||
51 | }; | ||
52 | |||
53 | &vip1 { | ||
54 | status = "okay"; | ||
55 | }; | ||
56 | |||
57 | &ovcam_fc { | ||
58 | /* Select between onboard OV10633 camera and daughter card vin | ||
59 | * Also enable power for the OVcamera externally | ||
60 | */ | ||
61 | mux-gpios = | ||
62 | <&pcf_hdmi 2 GPIO_ACTIVE_LOW>, /* VIN2_S0 */ | ||
63 | <&pcf_hdmi 6 GPIO_ACTIVE_HIGH>, /* VIN2_S2 */ | ||
64 | <&gpio6 17 GPIO_ACTIVE_HIGH>; /* OV_PWDN */ | ||
65 | }; | ||
66 | |||
67 | &ovcam1 { | ||
68 | /* Select between OV10633 camera, ethernet and external vin2a */ | ||
69 | mux-gpios = | ||
70 | <&pcf_hdmi 2 GPIO_ACTIVE_LOW>, /* VIN2_S0 */ | ||
71 | <&pcf_hdmi 6 GPIO_ACTIVE_HIGH>; /* VIN2_S2 */ | ||
72 | }; | ||
73 | |||
74 | &ovcam2 { | ||
75 | /* Select between GPMC, VOUT3 (FPDlink disp) and external vin1a */ | ||
76 | mux-gpios = | ||
77 | <&pcf_gpio_21 0 GPIO_ACTIVE_HIGH>, /* SEL_GPMC_AD_VID_S0 */ | ||
78 | <&pcf_gpio_21 7 GPIO_ACTIVE_LOW>; /* SEL_GPMC_AD_VID_S2 */ | ||
79 | }; | ||
80 | |||
81 | &ovcam3 { | ||
82 | status = "disabled"; | ||
83 | }; | ||
84 | |||
85 | &ovcam4 { | ||
86 | /* Select */ | ||
87 | mux-gpios = | ||
88 | <&pcf_hdmi 11 GPIO_ACTIVE_LOW>; /* MMC3_SEL */ | ||
89 | }; | ||
90 | |||
91 | &ovcam5 { | ||
92 | /* No board muxes */ | ||
93 | }; | ||
94 | |||
95 | &ovcam6 { | ||
96 | status = "disabled"; | ||
97 | }; | ||
98 | |||
99 | &pcf_gpio_21 { | ||
100 | cpsw_sel_s0 { | ||
101 | status = "disabled"; | ||
102 | }; | ||
103 | }; | ||
104 | |||
105 | &vin1a { | ||
106 | status = "okay"; | ||
107 | endpoint@0 { | ||
108 | slave-mode; | ||
109 | remote-endpoint = <&cam2>; | ||
110 | }; | ||
111 | }; | ||
112 | |||
113 | &vin1b { | ||
114 | status = "okay"; | ||
115 | endpoint@0 { | ||
116 | slave-mode; | ||
117 | remote-endpoint = <&cam5>; | ||
118 | }; | ||
119 | }; | ||
120 | |||
121 | &vin2a { | ||
122 | status = "okay"; | ||
123 | endpoint@0 { | ||
124 | slave-mode; | ||
125 | remote-endpoint = <&cam1>; | ||
126 | }; | ||
127 | endpoint@1 { | ||
128 | slave-mode; | ||
129 | remote-endpoint = <&ovcam>; | ||
130 | }; | ||
131 | }; | ||
132 | |||
133 | &vin2b { | ||
134 | status = "okay"; | ||
135 | endpoint@0 { | ||
136 | slave-mode; | ||
137 | remote-endpoint = <&cam4>; | ||
138 | }; | ||
139 | }; | ||
diff --git a/arch/arm/boot/dts/dra72-evm.dts b/arch/arm/boot/dts/dra72-evm.dts index c2a4bc1ad423..deef9b8520b2 100644 --- a/arch/arm/boot/dts/dra72-evm.dts +++ b/arch/arm/boot/dts/dra72-evm.dts | |||
@@ -9,12 +9,19 @@ | |||
9 | / { | 9 | / { |
10 | model = "TI DRA722"; | 10 | model = "TI DRA722"; |
11 | 11 | ||
12 | aliases { | ||
13 | display0 = &hdmi0; | ||
14 | display1 = &fpd_disp; | ||
15 | sound1 = &hdmi; | ||
16 | i2c7 = &disp_ser; | ||
17 | }; | ||
18 | |||
12 | memory { | 19 | memory { |
13 | device_type = "memory"; | 20 | device_type = "memory"; |
14 | reg = <0x0 0x80000000 0x0 0x40000000>; /* 1024 MB */ | 21 | reg = <0x0 0x80000000 0x0 0x40000000>; /* 1024 MB */ |
15 | }; | 22 | }; |
16 | 23 | ||
17 | reserved-memory { | 24 | reserved_mem: reserved-memory { |
18 | #address-cells = <2>; | 25 | #address-cells = <2>; |
19 | #size-cells = <2>; | 26 | #size-cells = <2>; |
20 | ranges; | 27 | ranges; |
@@ -208,6 +215,39 @@ | |||
208 | }; | 215 | }; |
209 | }; | 216 | }; |
210 | 217 | ||
218 | &i2c5 { | ||
219 | disp_ser: serializer@1b { | ||
220 | compatible = "ti,ds90uh925q"; | ||
221 | reg = <0x1b>; | ||
222 | |||
223 | #address-cells = <1>; | ||
224 | #size-cells = <0>; | ||
225 | ranges = <0x2c 0x2c>, | ||
226 | <0x1c 0x1c>; | ||
227 | |||
228 | disp_des: deserializer@2c { | ||
229 | compatible = "ti,ds90uh928q"; | ||
230 | reg = <0x2c>; | ||
231 | slave-mode; | ||
232 | }; | ||
233 | |||
234 | /* TLC chip for LCD panel power and backlight */ | ||
235 | fpd_disp: tlc59108@1c { | ||
236 | status = "disabled"; | ||
237 | reg = <0x1c>; | ||
238 | compatible = "ti,tlc59108-fpddisp"; | ||
239 | enable-gpios = <&pcf_gpio_21 0 GPIO_ACTIVE_LOW>; | ||
240 | /* P0, SEL_GPMC_AD_VID_S0 */ | ||
241 | |||
242 | port@lcd3 { | ||
243 | fpd_in: endpoint { | ||
244 | remote-endpoint = <&dpi_out3>; | ||
245 | }; | ||
246 | }; | ||
247 | }; | ||
248 | }; | ||
249 | }; | ||
250 | |||
211 | &hdmi { | 251 | &hdmi { |
212 | vdda_video-supply = <&ldo5_reg>; | 252 | vdda_video-supply = <&ldo5_reg>; |
213 | }; | 253 | }; |
@@ -260,3 +300,18 @@ | |||
260 | status = "okay"; | 300 | status = "okay"; |
261 | memory-region = <&dsp1_cma_pool>; | 301 | memory-region = <&dsp1_cma_pool>; |
262 | }; | 302 | }; |
303 | |||
304 | video_in: &vin2a { | ||
305 | status = "okay"; | ||
306 | endpoint@0 { | ||
307 | slave-mode; | ||
308 | remote-endpoint = <&onboardLI>; | ||
309 | }; | ||
310 | }; | ||
311 | |||
312 | #include "dra7xx-jamr3.dtsi" | ||
313 | &tvp_5158{ | ||
314 | mux-gpios = <&pcf_hdmi 2 GPIO_ACTIVE_LOW>, /*VIN2_S0*/ | ||
315 | <&pcf_jamr3_21 8 GPIO_ACTIVE_LOW>, /*SEL_TVP_FPD*/ | ||
316 | <&pcf_hdmi 6 GPIO_ACTIVE_HIGH>; /*VIN2_S2*/ | ||
317 | }; | ||
diff --git a/arch/arm/boot/dts/dra7x-evm-lcd-lg.dtsi b/arch/arm/boot/dts/dra7x-evm-lcd-lg.dtsi index 71bc803c8282..97939eef7b94 100644 --- a/arch/arm/boot/dts/dra7x-evm-lcd-lg.dtsi +++ b/arch/arm/boot/dts/dra7x-evm-lcd-lg.dtsi | |||
@@ -12,6 +12,7 @@ | |||
12 | aliases { | 12 | aliases { |
13 | display0 = &tlc59108; | 13 | display0 = &tlc59108; |
14 | display1 = &hdmi0; | 14 | display1 = &hdmi0; |
15 | display2 = &fpd_disp; | ||
15 | }; | 16 | }; |
16 | 17 | ||
17 | backlight { | 18 | backlight { |
@@ -83,6 +84,17 @@ | |||
83 | line-name = "LVDS_CLKSel"; | 84 | line-name = "LVDS_CLKSel"; |
84 | }; | 85 | }; |
85 | }; | 86 | }; |
87 | |||
88 | ldc3001:ldc3001@18 { | ||
89 | compatible = "lgphilips,ldc3001"; | ||
90 | status = "okay"; | ||
91 | reg = <0x18>; | ||
92 | interrupt-parent = <&gpio1>; | ||
93 | interrupts = <15 IRQ_TYPE_LEVEL_HIGH>; | ||
94 | max-touch-points = <10>; | ||
95 | res-x = <1280>; | ||
96 | res-y = <800>; | ||
97 | }; | ||
86 | }; | 98 | }; |
87 | 99 | ||
88 | &dss { | 100 | &dss { |
diff --git a/arch/arm/boot/dts/dra7x-evm-lcd-osd.dtsi b/arch/arm/boot/dts/dra7x-evm-lcd-osd.dtsi index 7dc9c986a73a..219e4f953797 100644 --- a/arch/arm/boot/dts/dra7x-evm-lcd-osd.dtsi +++ b/arch/arm/boot/dts/dra7x-evm-lcd-osd.dtsi | |||
@@ -10,6 +10,7 @@ | |||
10 | aliases { | 10 | aliases { |
11 | display0 = &lcd; | 11 | display0 = &lcd; |
12 | display1 = &hdmi0; | 12 | display1 = &hdmi0; |
13 | display2 = &fpd_disp; | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | lcd_bl: backlight { | 16 | lcd_bl: backlight { |
diff --git a/arch/arm/boot/dts/dra7xx-jamr3.dtsi b/arch/arm/boot/dts/dra7xx-jamr3.dtsi new file mode 100644 index 000000000000..e8f35be0a40f --- /dev/null +++ b/arch/arm/boot/dts/dra7xx-jamr3.dtsi | |||
@@ -0,0 +1,203 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/ | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #include <dt-bindings/clk/ti-dra7-atl.h> | ||
10 | |||
11 | / { | ||
12 | jamr3_sound { | ||
13 | compatible = "simple-audio-card"; | ||
14 | simple-audio-card,name = "DRA7xx-JAMR3"; | ||
15 | simple-audio-card,widgets = | ||
16 | "Line", "Line Out", | ||
17 | "Line", "Line In"; | ||
18 | simple-audio-card,routing = | ||
19 | "Line Out", "LLOUT", | ||
20 | "Line Out", "RLOUT", | ||
21 | "LINE1L", "Line In", | ||
22 | "LINE1R", "Line In"; | ||
23 | simple-audio-card,format = "dsp_b"; | ||
24 | simple-audio-card,bitclock-master = <&jamr3_sound_master>; | ||
25 | simple-audio-card,frame-master = <&jamr3_sound_master>; | ||
26 | simple-audio-card,bitclock-inversion; | ||
27 | |||
28 | jamr3_sound_master: simple-audio-card,cpu { | ||
29 | sound-dai = <&mcasp6>; | ||
30 | system-clock-frequency = <11289600>; | ||
31 | }; | ||
32 | |||
33 | simple-audio-card,codec { | ||
34 | sound-dai = <&tlv320aic3106a>; | ||
35 | clocks = <&atl_clkin1_ck>; | ||
36 | }; | ||
37 | }; | ||
38 | |||
39 | gatemp { | ||
40 | compatible = "hwspinlock-user"; | ||
41 | hwlocks = <&hwspinlock 0>, | ||
42 | <&hwspinlock 1>, | ||
43 | <&hwspinlock 2>, | ||
44 | <&hwspinlock 3>, | ||
45 | <&hwspinlock 4>, | ||
46 | <&hwspinlock 5>, | ||
47 | <&hwspinlock 6>, | ||
48 | <&hwspinlock 7>, | ||
49 | <&hwspinlock 8>, | ||
50 | <&hwspinlock 9>; | ||
51 | }; | ||
52 | |||
53 | sr0 { | ||
54 | compatible = "generic-uio"; | ||
55 | reg = <0x0 0xbfb00000 0x0 0x100000>; | ||
56 | }; | ||
57 | }; | ||
58 | |||
59 | &reserved_mem { | ||
60 | /* Required by cmem driver used by radio */ | ||
61 | cmem_radio: cmem@95400000 { | ||
62 | reg = <0x0 0x95400000 0x0 0x400000>; | ||
63 | no-map; | ||
64 | status = "okay"; | ||
65 | }; | ||
66 | |||
67 | dsp1_sr0: dsp1_sr0@bfb00000 { | ||
68 | reg = <0x0 0xbfb00000 0x0 0x100000>; | ||
69 | no-map; | ||
70 | status = "okay"; | ||
71 | }; | ||
72 | }; | ||
73 | |||
74 | &gpio6 { | ||
75 | p20 { | ||
76 | /* Radio reset GPIO */ | ||
77 | gpio-hog; | ||
78 | gpios = <1 GPIO_ACTIVE_LOW>; | ||
79 | output-low; | ||
80 | line-name = "radio_rst"; | ||
81 | }; | ||
82 | }; | ||
83 | |||
84 | &atl { | ||
85 | atl1 { | ||
86 | bws = <DRA7_ATL_WS_MCASP2_FSX>; | ||
87 | aws = <DRA7_ATL_WS_MCASP6_FSX>; | ||
88 | }; | ||
89 | }; | ||
90 | |||
91 | &mcasp2 { | ||
92 | assigned-clocks = <&mcasp2_ahclkx_mux>; | ||
93 | assigned-clock-parents = <&atl_clkin2_ck>; | ||
94 | |||
95 | status = "okay"; | ||
96 | |||
97 | op-mode = <0>; /* MCASP_IIS_MODE */ | ||
98 | tdm-slots = <2>; | ||
99 | /* 8 serializers */ | ||
100 | serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */ | ||
101 | 2 0 0 0 0 0 0 0 | ||
102 | >; | ||
103 | shared-dai; | ||
104 | }; | ||
105 | |||
106 | &mcasp6 { | ||
107 | #sound-dai-cells = <0>; | ||
108 | assigned-clocks = <&mcasp6_ahclkx_mux>; | ||
109 | assigned-clock-parents = <&atl_clkin1_ck>; | ||
110 | |||
111 | status = "okay"; | ||
112 | |||
113 | op-mode = <0>; /* MCASP_IIS_MODE */ | ||
114 | tdm-slots = <2>; | ||
115 | /* 4 serializer */ | ||
116 | serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */ | ||
117 | 1 2 0 0 | ||
118 | >; | ||
119 | tx-num-evt = <32>; | ||
120 | rx-num-evt = <32>; | ||
121 | shared-dai; | ||
122 | }; | ||
123 | |||
124 | &i2c4 { | ||
125 | status = "okay"; | ||
126 | clock-frequency = <400000>; | ||
127 | |||
128 | pcf_jamr3_21: pcf8575@21 { | ||
129 | compatible = "nxp,pcf8575"; | ||
130 | reg = <0x21>; | ||
131 | gpio-controller; | ||
132 | #gpio-cells = <2>; | ||
133 | }; | ||
134 | }; | ||
135 | |||
136 | &i2c_p3_exp { | ||
137 | tlv320aic3106a: tlv320aic3106@18 { | ||
138 | #sound-dai-cells = <0>; | ||
139 | compatible = "ti,tlv320aic3106"; | ||
140 | reg = <0x18>; | ||
141 | adc-settle-ms = <40>; | ||
142 | ai3x-micbias-vg = <1>; /* 2.0V */ | ||
143 | name-prefix = "J3A"; | ||
144 | status = "okay"; | ||
145 | |||
146 | /* Regulators */ | ||
147 | AVDD-supply = <&evm_3v3_sw>; | ||
148 | IOVDD-supply = <&evm_3v3_sw>; | ||
149 | DRVDD-supply = <&evm_3v3_sw>; | ||
150 | DVDD-supply = <&aic_dvdd>; | ||
151 | }; | ||
152 | |||
153 | tlv320aic3106b: tlv320aic3106@19 { | ||
154 | #sound-dai-cells = <0>; | ||
155 | compatible = "ti,tlv320aic3106"; | ||
156 | reg = <0x19>; | ||
157 | adc-settle-ms = <40>; | ||
158 | ai3x-micbias-vg = <1>; /* 2.0V */ | ||
159 | name-prefix = "J3B"; | ||
160 | status = "okay"; | ||
161 | |||
162 | /* Regulators */ | ||
163 | AVDD-supply = <&evm_3v3_sw>; | ||
164 | IOVDD-supply = <&evm_3v3_sw>; | ||
165 | DRVDD-supply = <&evm_3v3_sw>; | ||
166 | DVDD-supply = <&aic_dvdd>; | ||
167 | }; | ||
168 | |||
169 | tlv320aic3106c: tlv320aic3106@1a { | ||
170 | #sound-dai-cells = <0>; | ||
171 | compatible = "ti,tlv320aic3106"; | ||
172 | reg = <0x1a>; | ||
173 | adc-settle-ms = <40>; | ||
174 | ai3x-micbias-vg = <1>; /* 2.0V */ | ||
175 | name-prefix = "J3C"; | ||
176 | status = "okay"; | ||
177 | |||
178 | /* Regulators */ | ||
179 | AVDD-supply = <&evm_3v3_sw>; | ||
180 | IOVDD-supply = <&evm_3v3_sw>; | ||
181 | DRVDD-supply = <&evm_3v3_sw>; | ||
182 | DVDD-supply = <&aic_dvdd>; | ||
183 | }; | ||
184 | |||
185 | tvp_5158: tvp5158@58 { | ||
186 | compatible= "ti,tvp5158"; | ||
187 | reg = <0x58>; | ||
188 | |||
189 | port { | ||
190 | tvp_decoder: endpoint@0 { | ||
191 | pclk-sample = <0>; | ||
192 | channels = <0 2 4 6>; | ||
193 | }; | ||
194 | }; | ||
195 | }; | ||
196 | }; | ||
197 | |||
198 | &video_in { | ||
199 | endpoint { | ||
200 | slave-mode; | ||
201 | remote-endpoint = <&tvp_decoder>; | ||
202 | }; | ||
203 | }; | ||
diff --git a/arch/arm/boot/dts/dra7xx-vision.dtsi b/arch/arm/boot/dts/dra7xx-vision.dtsi new file mode 100644 index 000000000000..f593a68c8777 --- /dev/null +++ b/arch/arm/boot/dts/dra7xx-vision.dtsi | |||
@@ -0,0 +1,306 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/ | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | /* | ||
10 | * Uncomment this define to enable IMI camera support | ||
11 | * #define VISION_IMI2_CAMERA | ||
12 | */ | ||
13 | / { | ||
14 | aliases { | ||
15 | i2c11 = &lvds_des1; | ||
16 | i2c12 = &lvds_des2; | ||
17 | i2c13 = &lvds_des3; | ||
18 | i2c14 = &lvds_des4; | ||
19 | i2c15 = &lvds_des5; | ||
20 | i2c16 = &lvds_des6; | ||
21 | }; | ||
22 | }; | ||
23 | |||
24 | &i2cexp { | ||
25 | |||
26 | ovcam_fc: ov10635@30 { | ||
27 | compatible = "ovti,ov10635"; | ||
28 | reg = <0x30>; | ||
29 | |||
30 | port { | ||
31 | ovcam: endpoint { | ||
32 | hsync-active = <1>; | ||
33 | vsync-active = <1>; | ||
34 | pclk-sample = <1>; | ||
35 | }; | ||
36 | }; | ||
37 | }; | ||
38 | |||
39 | /* | ||
40 | * These are I/O expanders which drive some signals of the deserializer | ||
41 | * Each 16bit I/O expander drives two deserializers | ||
42 | * The mapping of I/O expanders and deserializer is as follows:- | ||
43 | * I/O Expander | Deserializer | ||
44 | * -------------+---------------- | ||
45 | * mcp_ioexp1(0x27) | lvds_des1(0x60) | ||
46 | * mcp_ioexp1(0x27) | lvds_des2(0x64) | ||
47 | * mcp_ioexp2(0x21) | lvds_des3(0x68) | ||
48 | * mcp_ioexp2(0x21) | lvds_des4(0x6c) | ||
49 | * mcp_ioexp3(0x25) | lvds_des5(0x61) | ||
50 | * mcp_ioexp4(0x25) | lvds_des6(0x69) | ||
51 | */ | ||
52 | mcp_ioexp1: ioexp@27 { | ||
53 | compatible = "microchip,mcp23017"; | ||
54 | reg=<0x27>; | ||
55 | gpio-controller; | ||
56 | #gpio-cells = <2>; | ||
57 | |||
58 | init-dir = <0x0000>; | ||
59 | #ifdef VISION_IMI2_CAMERA | ||
60 | init-val = <0x6B6B>; | ||
61 | #else | ||
62 | init-val = <0x6363>; | ||
63 | #endif | ||
64 | /* 15:pdb, 14:sel, 13:oen, 12:bisten, 11:gpio0, 10-8:mode | ||
65 | * 7:pdb, 6:sel, 5:oen, 4:bisten, 3:gpio0, 2-0:mode | ||
66 | */ | ||
67 | }; | ||
68 | |||
69 | mcp_ioexp2: ioexp@21 { | ||
70 | compatible = "microchip,mcp23017"; | ||
71 | reg=<0x21>; | ||
72 | gpio-controller; | ||
73 | #gpio-cells = <2>; | ||
74 | |||
75 | init-dir = <0x0000>; | ||
76 | #ifdef VISION_IMI2_CAMERA | ||
77 | init-val = <0x6B6B>; | ||
78 | #else | ||
79 | init-val = <0x6363>; | ||
80 | #endif | ||
81 | /* 15:pdb, 14:sel, 13:oen, 12:bisten, 11:gpio0, 10-8:mode | ||
82 | * 7:pdb, 6:sel, 5:oen, 4:bisten, 3:gpio0, 2-0:mode | ||
83 | */ | ||
84 | }; | ||
85 | |||
86 | mcp_ioexp3: ioexp@25 { | ||
87 | compatible = "microchip,mcp23017"; | ||
88 | reg=<0x25>; | ||
89 | gpio-controller; | ||
90 | #gpio-cells = <2>; | ||
91 | |||
92 | init-dir = <0x0000>; | ||
93 | #ifdef VISION_IMI2_CAMERA | ||
94 | init-val = <0x6B6B>; | ||
95 | #else | ||
96 | init-val = <0x6363>; | ||
97 | #endif | ||
98 | /* 15:pdb, 14:sel, 13:oen, 12:bisten, 11:gpio0, 10-8:mode | ||
99 | * 7:pdb, 6:sel, 5:oen, 4:bisten, 3:gpio0, 2-0:mode | ||
100 | */ | ||
101 | }; | ||
102 | |||
103 | lvds_des1: deserializer@60 { | ||
104 | compatible = "ti,ds90ub914aq"; | ||
105 | reg = <0x60>; | ||
106 | |||
107 | gpios = <&mcp_ioexp1 7 0>; /* pdb */ | ||
108 | |||
109 | #address-cells = <1>; | ||
110 | #size-cells = <0>; | ||
111 | }; | ||
112 | |||
113 | lvds_des2: deserializer@64 { | ||
114 | compatible = "ti,ds90ub914aq"; | ||
115 | reg = <0x64>; | ||
116 | |||
117 | gpios = <&mcp_ioexp1 15 0>; /* pdb */ | ||
118 | |||
119 | #address-cells = <1>; | ||
120 | #size-cells = <0>; | ||
121 | }; | ||
122 | |||
123 | lvds_des3: deserializer@68 { | ||
124 | compatible = "ti,ds90ub914aq"; | ||
125 | reg = <0x68>; | ||
126 | |||
127 | gpios = <&mcp_ioexp2 7 0>; /* pdb */ | ||
128 | |||
129 | #address-cells = <1>; | ||
130 | #size-cells = <0>; | ||
131 | }; | ||
132 | |||
133 | lvds_des4: deserializer@6c { | ||
134 | compatible = "ti,ds90ub914aq"; | ||
135 | reg = <0x6c>; | ||
136 | |||
137 | gpios = <&mcp_ioexp2 15 0>; /* pdb */ | ||
138 | |||
139 | #address-cells = <1>; | ||
140 | #size-cells = <0>; | ||
141 | }; | ||
142 | |||
143 | lvds_des5: deserializer@61 { | ||
144 | compatible = "ti,ds90ub914aq"; | ||
145 | reg = <0x61>; | ||
146 | |||
147 | gpios = <&mcp_ioexp3 7 0>; /* pdb */ | ||
148 | |||
149 | #address-cells = <1>; | ||
150 | #size-cells = <0>; | ||
151 | }; | ||
152 | |||
153 | lvds_des6: deserializer@69 { | ||
154 | compatible = "ti,ds90ub914aq"; | ||
155 | reg = <0x69>; | ||
156 | |||
157 | gpios = <&mcp_ioexp3 15 0>; /* pdb */ | ||
158 | |||
159 | #address-cells = <1>; | ||
160 | #size-cells = <0>; | ||
161 | }; | ||
162 | }; | ||
163 | |||
164 | &lvds_des1 { | ||
165 | ranges = <0x58 0x74>, | ||
166 | <0x30 0x38>; | ||
167 | |||
168 | lvds_ser1: serializer@74 { | ||
169 | compatible = "ti,ds90ub913aq"; | ||
170 | reg = <0x58>; | ||
171 | slave-mode; | ||
172 | }; | ||
173 | |||
174 | ovcam1: ov10635@38 { | ||
175 | compatible = "ovti,ov10635"; | ||
176 | reg = <0x30>; | ||
177 | |||
178 | port { | ||
179 | cam1: endpoint { | ||
180 | hsync-active = <1>; | ||
181 | vsync-active = <1>; | ||
182 | pclk-sample = <0>; | ||
183 | }; | ||
184 | }; | ||
185 | }; | ||
186 | }; | ||
187 | |||
188 | &lvds_des2 { | ||
189 | ranges = <0x58 0x75>, | ||
190 | <0x30 0x39>; | ||
191 | |||
192 | lvds_ser2: serializer@75 { | ||
193 | compatible = "ti,ds90ub913aq"; | ||
194 | reg = <0x58>; | ||
195 | slave-mode; | ||
196 | }; | ||
197 | |||
198 | ovcam2: ov10635@39 { | ||
199 | compatible = "ovti,ov10635"; | ||
200 | reg = <0x30>; | ||
201 | |||
202 | port { | ||
203 | cam2: endpoint { | ||
204 | hsync-active = <1>; | ||
205 | vsync-active = <1>; | ||
206 | pclk-sample = <0>; | ||
207 | }; | ||
208 | }; | ||
209 | }; | ||
210 | }; | ||
211 | |||
212 | &lvds_des3 { | ||
213 | ranges = <0x58 0x76>, | ||
214 | <0x30 0x3a>; | ||
215 | |||
216 | lvds_ser3: serializer@76 { | ||
217 | compatible = "ti,ds90ub913aq"; | ||
218 | reg = <0x58>; | ||
219 | slave-mode; | ||
220 | }; | ||
221 | |||
222 | ovcam3: ov10635@3a { | ||
223 | compatible = "ovti,ov10635"; | ||
224 | reg = <0x30>; | ||
225 | |||
226 | port { | ||
227 | cam3: endpoint { | ||
228 | hsync-active = <1>; | ||
229 | vsync-active = <1>; | ||
230 | pclk-sample = <0>; | ||
231 | }; | ||
232 | }; | ||
233 | }; | ||
234 | }; | ||
235 | |||
236 | &lvds_des4 { | ||
237 | ranges = <0x58 0x77>, | ||
238 | <0x30 0x3b>; | ||
239 | |||
240 | lvds_ser4: serializer@77 { | ||
241 | compatible = "ti,ds90ub913aq"; | ||
242 | reg = <0x58>; | ||
243 | slave-mode; | ||
244 | }; | ||
245 | |||
246 | ovcam4: ov10635@3b { | ||
247 | compatible = "ovti,ov10635"; | ||
248 | reg = <0x30>; | ||
249 | |||
250 | port { | ||
251 | cam4: endpoint { | ||
252 | hsync-active = <1>; | ||
253 | vsync-active = <1>; | ||
254 | pclk-sample = <0>; | ||
255 | }; | ||
256 | }; | ||
257 | }; | ||
258 | }; | ||
259 | |||
260 | &lvds_des5 { | ||
261 | ranges = <0x58 0x78>, | ||
262 | <0x30 0x3c>; | ||
263 | |||
264 | lvds_ser5: serializer@78 { | ||
265 | compatible = "ti,ds90ub913aq"; | ||
266 | reg = <0x58>; | ||
267 | slave-mode; | ||
268 | }; | ||
269 | |||
270 | ovcam5: ov10635@3c { | ||
271 | compatible = "ovti,ov10635"; | ||
272 | reg = <0x30>; | ||
273 | |||
274 | port { | ||
275 | cam5: endpoint { | ||
276 | hsync-active = <1>; | ||
277 | vsync-active = <1>; | ||
278 | pclk-sample = <0>; | ||
279 | }; | ||
280 | }; | ||
281 | }; | ||
282 | }; | ||
283 | |||
284 | &lvds_des6 { | ||
285 | ranges = <0x58 0x79>, | ||
286 | <0x30 0x3d>; | ||
287 | |||
288 | lvds_ser6: serializer@79 { | ||
289 | compatible = "ti,ds90ub913aq"; | ||
290 | reg = <0x58>; | ||
291 | slave-mode; | ||
292 | }; | ||
293 | |||
294 | ovcam6: ov10635@3d { | ||
295 | compatible = "ovti,ov10635"; | ||
296 | reg = <0x30>; | ||
297 | |||
298 | port { | ||
299 | cam6: endpoint { | ||
300 | hsync-active = <1>; | ||
301 | vsync-active = <1>; | ||
302 | pclk-sample = <0>; | ||
303 | }; | ||
304 | }; | ||
305 | }; | ||
306 | }; | ||
diff --git a/arch/arm/mm/proc-syms.c b/arch/arm/mm/proc-syms.c index 054b491ff764..778e32c97913 100644 --- a/arch/arm/mm/proc-syms.c +++ b/arch/arm/mm/proc-syms.c | |||
@@ -30,6 +30,7 @@ EXPORT_SYMBOL(__cpuc_flush_user_all); | |||
30 | EXPORT_SYMBOL(__cpuc_flush_user_range); | 30 | EXPORT_SYMBOL(__cpuc_flush_user_range); |
31 | EXPORT_SYMBOL(__cpuc_coherent_kern_range); | 31 | EXPORT_SYMBOL(__cpuc_coherent_kern_range); |
32 | EXPORT_SYMBOL(__cpuc_flush_dcache_area); | 32 | EXPORT_SYMBOL(__cpuc_flush_dcache_area); |
33 | EXPORT_SYMBOL(dmac_flush_range); | ||
33 | #else | 34 | #else |
34 | EXPORT_SYMBOL(cpu_cache); | 35 | EXPORT_SYMBOL(cpu_cache); |
35 | #endif | 36 | #endif |
diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c index 4a41694919da..47cc4dcea36e 100644 --- a/drivers/gpio/gpio-mcp23s08.c +++ b/drivers/gpio/gpio-mcp23s08.c | |||
@@ -584,6 +584,7 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, | |||
584 | struct mcp23s08_platform_data *pdata, int cs) | 584 | struct mcp23s08_platform_data *pdata, int cs) |
585 | { | 585 | { |
586 | int status; | 586 | int status; |
587 | u32 init_dir = 0, init_val = 0; | ||
587 | bool mirror = false; | 588 | bool mirror = false; |
588 | 589 | ||
589 | mutex_init(&mcp->lock); | 590 | mutex_init(&mcp->lock); |
@@ -682,6 +683,14 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, | |||
682 | if (status < 0) | 683 | if (status < 0) |
683 | goto fail; | 684 | goto fail; |
684 | 685 | ||
686 | if (of_property_read_u32(mcp->chip.of_node, | ||
687 | "init-dir", &init_dir) == 0) | ||
688 | status = mcp->ops->write(mcp, MCP_IODIR, init_dir); | ||
689 | |||
690 | if (of_property_read_u32(mcp->chip.of_node, | ||
691 | "init-val", &init_val) == 0) | ||
692 | status = mcp->ops->write(mcp, MCP_OLAT, init_val); | ||
693 | |||
685 | status = mcp->ops->read_regs(mcp, 0, mcp->cache, ARRAY_SIZE(mcp->cache)); | 694 | status = mcp->ops->read_regs(mcp, 0, mcp->cache, ARRAY_SIZE(mcp->cache)); |
686 | if (status < 0) | 695 | if (status < 0) |
687 | goto fail; | 696 | goto fail; |
diff --git a/drivers/hwspinlock/Kconfig b/drivers/hwspinlock/Kconfig index 73a401662853..7980d5082197 100644 --- a/drivers/hwspinlock/Kconfig +++ b/drivers/hwspinlock/Kconfig | |||
@@ -8,6 +8,15 @@ config HWSPINLOCK | |||
8 | 8 | ||
9 | menu "Hardware Spinlock drivers" | 9 | menu "Hardware Spinlock drivers" |
10 | 10 | ||
11 | config HWSPINLOCK_USER | ||
12 | tristate "Hardware Spinlock User-Space Interface" | ||
13 | depends on HWSPINLOCK | ||
14 | help | ||
15 | Say y here to have an user-space interface for the hardware spinlock | ||
16 | functionality. | ||
17 | |||
18 | If unsure, say N. | ||
19 | |||
11 | config HWSPINLOCK_OMAP | 20 | config HWSPINLOCK_OMAP |
12 | tristate "OMAP Hardware Spinlock device" | 21 | tristate "OMAP Hardware Spinlock device" |
13 | depends on ARCH_OMAP4 || SOC_OMAP5 || SOC_DRA7XX || SOC_AM33XX || SOC_AM43XX | 22 | depends on ARCH_OMAP4 || SOC_OMAP5 || SOC_DRA7XX || SOC_AM33XX || SOC_AM43XX |
diff --git a/drivers/hwspinlock/Makefile b/drivers/hwspinlock/Makefile index 6b59cb5a4f3a..1407cbad4df0 100644 --- a/drivers/hwspinlock/Makefile +++ b/drivers/hwspinlock/Makefile | |||
@@ -3,6 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-$(CONFIG_HWSPINLOCK) += hwspinlock_core.o | 5 | obj-$(CONFIG_HWSPINLOCK) += hwspinlock_core.o |
6 | obj-$(CONFIG_HWSPINLOCK_USER) += hwspinlock_user.o | ||
6 | obj-$(CONFIG_HWSPINLOCK_OMAP) += omap_hwspinlock.o | 7 | obj-$(CONFIG_HWSPINLOCK_OMAP) += omap_hwspinlock.o |
7 | obj-$(CONFIG_HWSPINLOCK_QCOM) += qcom_hwspinlock.o | 8 | obj-$(CONFIG_HWSPINLOCK_QCOM) += qcom_hwspinlock.o |
8 | obj-$(CONFIG_HWSPINLOCK_SIRF) += sirf_hwspinlock.o | 9 | obj-$(CONFIG_HWSPINLOCK_SIRF) += sirf_hwspinlock.o |
diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c index d50c701b19d6..6122b5f1ca60 100644 --- a/drivers/hwspinlock/hwspinlock_core.c +++ b/drivers/hwspinlock/hwspinlock_core.c | |||
@@ -110,6 +110,8 @@ int __hwspin_trylock(struct hwspinlock *hwlock, int mode, unsigned long *flags) | |||
110 | ret = spin_trylock_irqsave(&hwlock->lock, *flags); | 110 | ret = spin_trylock_irqsave(&hwlock->lock, *flags); |
111 | else if (mode == HWLOCK_IRQ) | 111 | else if (mode == HWLOCK_IRQ) |
112 | ret = spin_trylock_irq(&hwlock->lock); | 112 | ret = spin_trylock_irq(&hwlock->lock); |
113 | else if (mode == HWLOCK_MUTEX) | ||
114 | ret = mutex_trylock(&hwlock->mutex); | ||
113 | else | 115 | else |
114 | ret = spin_trylock(&hwlock->lock); | 116 | ret = spin_trylock(&hwlock->lock); |
115 | 117 | ||
@@ -126,6 +128,8 @@ int __hwspin_trylock(struct hwspinlock *hwlock, int mode, unsigned long *flags) | |||
126 | spin_unlock_irqrestore(&hwlock->lock, *flags); | 128 | spin_unlock_irqrestore(&hwlock->lock, *flags); |
127 | else if (mode == HWLOCK_IRQ) | 129 | else if (mode == HWLOCK_IRQ) |
128 | spin_unlock_irq(&hwlock->lock); | 130 | spin_unlock_irq(&hwlock->lock); |
131 | else if (mode == HWLOCK_MUTEX) | ||
132 | mutex_unlock(&hwlock->mutex); | ||
129 | else | 133 | else |
130 | spin_unlock(&hwlock->lock); | 134 | spin_unlock(&hwlock->lock); |
131 | 135 | ||
@@ -253,6 +257,8 @@ void __hwspin_unlock(struct hwspinlock *hwlock, int mode, unsigned long *flags) | |||
253 | spin_unlock_irqrestore(&hwlock->lock, *flags); | 257 | spin_unlock_irqrestore(&hwlock->lock, *flags); |
254 | else if (mode == HWLOCK_IRQ) | 258 | else if (mode == HWLOCK_IRQ) |
255 | spin_unlock_irq(&hwlock->lock); | 259 | spin_unlock_irq(&hwlock->lock); |
260 | else if (mode == HWLOCK_MUTEX) | ||
261 | mutex_unlock(&hwlock->mutex); | ||
256 | else | 262 | else |
257 | spin_unlock(&hwlock->lock); | 263 | spin_unlock(&hwlock->lock); |
258 | } | 264 | } |
@@ -426,6 +432,7 @@ int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev, | |||
426 | hwlock = &bank->lock[i]; | 432 | hwlock = &bank->lock[i]; |
427 | 433 | ||
428 | spin_lock_init(&hwlock->lock); | 434 | spin_lock_init(&hwlock->lock); |
435 | mutex_init(&hwlock->mutex); | ||
429 | hwlock->bank = bank; | 436 | hwlock->bank = bank; |
430 | 437 | ||
431 | ret = hwspin_lock_register_single(hwlock, base_id + i); | 438 | ret = hwspin_lock_register_single(hwlock, base_id + i); |
diff --git a/drivers/hwspinlock/hwspinlock_internal.h b/drivers/hwspinlock/hwspinlock_internal.h index d26f78b8f214..586e64630632 100644 --- a/drivers/hwspinlock/hwspinlock_internal.h +++ b/drivers/hwspinlock/hwspinlock_internal.h | |||
@@ -48,6 +48,7 @@ struct hwspinlock_ops { | |||
48 | struct hwspinlock { | 48 | struct hwspinlock { |
49 | struct hwspinlock_device *bank; | 49 | struct hwspinlock_device *bank; |
50 | spinlock_t lock; | 50 | spinlock_t lock; |
51 | struct mutex mutex; | ||
51 | void *priv; | 52 | void *priv; |
52 | }; | 53 | }; |
53 | 54 | ||
diff --git a/drivers/hwspinlock/hwspinlock_user.c b/drivers/hwspinlock/hwspinlock_user.c new file mode 100644 index 000000000000..327c226b68f1 --- /dev/null +++ b/drivers/hwspinlock/hwspinlock_user.c | |||
@@ -0,0 +1,231 @@ | |||
1 | /* | ||
2 | * Userspace interface to hardware spinlocks | ||
3 | * | ||
4 | * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * version 2 as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, but | ||
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | * General Public License for more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/device.h> | ||
19 | #include <linux/hwspinlock.h> | ||
20 | #include <linux/of_device.h> | ||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/uaccess.h> | ||
23 | #include <linux/fs.h> | ||
24 | #include <uapi/linux/hwspinlock_user.h> | ||
25 | |||
26 | #include <linux/miscdevice.h> | ||
27 | |||
28 | struct hwlock { | ||
29 | struct hwspinlock *hwlock; | ||
30 | struct file *owner; | ||
31 | }; | ||
32 | |||
33 | struct hwspinlock_user { | ||
34 | struct device *dev; | ||
35 | struct mutex mutex; | ||
36 | |||
37 | int num_locks; | ||
38 | struct hwlock locks[0]; | ||
39 | }; | ||
40 | |||
41 | struct hwspinlock_user *user; | ||
42 | |||
43 | static long hwspinlock_user_ioctl(struct file *filp, unsigned int cmd, | ||
44 | unsigned long arg) | ||
45 | { | ||
46 | struct hwspinlock *hwlock = NULL; | ||
47 | union { | ||
48 | struct hwspinlock_user_lock lock; | ||
49 | struct hwspinlock_user_unlock unlock; | ||
50 | } data; | ||
51 | int i, id, ret = 0; | ||
52 | |||
53 | if (copy_from_user(&data, (void __user *)arg, _IOC_SIZE(cmd))) | ||
54 | return -EFAULT; | ||
55 | |||
56 | mutex_unlock(&user->mutex); | ||
57 | |||
58 | switch (cmd) { | ||
59 | case HWSPINLOCK_USER_LOCK: | ||
60 | for (i = 0; i < user->num_locks; i++) { | ||
61 | id = hwspin_lock_get_id(user->locks[i].hwlock); | ||
62 | if (id == data.lock.id) { | ||
63 | hwlock = user->locks[i].hwlock; | ||
64 | break; | ||
65 | } | ||
66 | } | ||
67 | |||
68 | if (hwlock) { | ||
69 | ret = hwspin_lock_timeout_can_sleep(hwlock, | ||
70 | data.lock.timeout); | ||
71 | if (!ret) | ||
72 | user->locks[i].owner = filp; | ||
73 | } else { | ||
74 | dev_err(user->dev, "hwspinlock %d is not reserved\n", | ||
75 | data.lock.id); | ||
76 | ret = -EINVAL; | ||
77 | } | ||
78 | break; | ||
79 | |||
80 | case HWSPINLOCK_USER_UNLOCK: | ||
81 | for (i = 0; i < user->num_locks; i++) { | ||
82 | id = hwspin_lock_get_id(user->locks[i].hwlock); | ||
83 | if (id == data.unlock.id) { | ||
84 | hwlock = user->locks[i].hwlock; | ||
85 | break; | ||
86 | } | ||
87 | } | ||
88 | |||
89 | if (hwlock) { | ||
90 | hwspin_unlock_can_sleep(hwlock); | ||
91 | user->locks[i].owner = NULL; | ||
92 | } else { | ||
93 | dev_err(user->dev, "hwspinlock %d is not reserved\n", | ||
94 | data.unlock.id); | ||
95 | ret = -EINVAL; | ||
96 | } | ||
97 | break; | ||
98 | |||
99 | default: | ||
100 | ret = -ENOTTY; | ||
101 | break; | ||
102 | } | ||
103 | |||
104 | mutex_unlock(&user->mutex); | ||
105 | |||
106 | return ret; | ||
107 | } | ||
108 | |||
109 | static int hwspinlock_user_release(struct inode *inode, struct file *filp) | ||
110 | { | ||
111 | int i; | ||
112 | |||
113 | mutex_lock(&user->mutex); | ||
114 | |||
115 | for (i = 0; i < user->num_locks; i++) { | ||
116 | if (user->locks[i].owner == filp) { | ||
117 | dev_warn(user->dev, | ||
118 | "hwspinlock %d is forcefully unlocked\n", | ||
119 | hwspin_lock_get_id(user->locks[i].hwlock)); | ||
120 | hwspin_unlock_can_sleep(user->locks[i].hwlock); | ||
121 | } | ||
122 | } | ||
123 | |||
124 | mutex_unlock(&user->mutex); | ||
125 | |||
126 | return 0; | ||
127 | } | ||
128 | |||
129 | |||
130 | static const struct file_operations hwspinlock_user_fops = { | ||
131 | .owner = THIS_MODULE, | ||
132 | .unlocked_ioctl = hwspinlock_user_ioctl, | ||
133 | .release = hwspinlock_user_release, | ||
134 | .llseek = noop_llseek, | ||
135 | }; | ||
136 | |||
137 | static struct miscdevice hwspinlock_user_miscdev = { | ||
138 | .minor = MISC_DYNAMIC_MINOR, | ||
139 | .name = "hwspinlock", | ||
140 | .fops = &hwspinlock_user_fops, | ||
141 | }; | ||
142 | |||
143 | static int hwspinlock_user_probe(struct platform_device *pdev) | ||
144 | { | ||
145 | struct device_node *node = pdev->dev.of_node; | ||
146 | struct hwspinlock *hwlock; | ||
147 | int num, id, i; | ||
148 | int ret; | ||
149 | |||
150 | if (!node) | ||
151 | return -ENODEV; | ||
152 | |||
153 | num = of_count_phandle_with_args(node, "hwlocks", "#hwlock-cells"); | ||
154 | |||
155 | user = devm_kzalloc(&pdev->dev, sizeof(struct hwspinlock_user) + | ||
156 | num * sizeof(struct hwlock), GFP_KERNEL); | ||
157 | if (!user) | ||
158 | return -ENOMEM; | ||
159 | |||
160 | user->dev = &pdev->dev; | ||
161 | user->num_locks = num; | ||
162 | mutex_init(&user->mutex); | ||
163 | |||
164 | ret = misc_register(&hwspinlock_user_miscdev); | ||
165 | if (ret) { | ||
166 | dev_err(user->dev, "failed to register miscdev %d\n", ret); | ||
167 | return ret; | ||
168 | } | ||
169 | |||
170 | for (i = 0; i < user->num_locks; i++) { | ||
171 | id = of_hwspin_lock_get_id(node, i); | ||
172 | if (id < 0) { | ||
173 | dev_err(user->dev, "failed to get lock id %d\n", id); | ||
174 | ret = -ENODEV; | ||
175 | goto err; | ||
176 | } | ||
177 | |||
178 | hwlock = hwspin_lock_request_specific(id); | ||
179 | if (IS_ERR_OR_NULL(hwlock)) { | ||
180 | dev_err(user->dev, "failed to request lock %d\n", id); | ||
181 | ret = IS_ERR(hwlock) ? PTR_ERR(hwlock) : -EBUSY; | ||
182 | goto err; | ||
183 | } | ||
184 | |||
185 | user->locks[i].hwlock = hwlock; | ||
186 | } | ||
187 | |||
188 | dev_info(user->dev, "requested %d hwspinlocks\n", i); | ||
189 | |||
190 | platform_set_drvdata(pdev, user); | ||
191 | |||
192 | return 0; | ||
193 | |||
194 | err: | ||
195 | misc_deregister(&hwspinlock_user_miscdev); | ||
196 | for (i--; i >= 0; i--) | ||
197 | hwspin_lock_free(user->locks[i].hwlock); | ||
198 | |||
199 | return ret; | ||
200 | } | ||
201 | |||
202 | static int hwspinlock_user_remove(struct platform_device *pdev) | ||
203 | { | ||
204 | struct hwspinlock_user *user = platform_get_drvdata(pdev); | ||
205 | int i; | ||
206 | |||
207 | misc_deregister(&hwspinlock_user_miscdev); | ||
208 | |||
209 | for (i = 0; i < user->num_locks; i++) | ||
210 | hwspin_lock_free(user->locks[i].hwlock); | ||
211 | |||
212 | return 0; | ||
213 | } | ||
214 | |||
215 | static const struct of_device_id hwspinlock_user_of_match[] = { | ||
216 | { .compatible = "hwspinlock-user", }, | ||
217 | { /* end */ }, | ||
218 | }; | ||
219 | MODULE_DEVICE_TABLE(of, hwspinlock_user_of_match); | ||
220 | |||
221 | static struct platform_driver hwspinlock_user_driver = { | ||
222 | .probe = hwspinlock_user_probe, | ||
223 | .remove = hwspinlock_user_remove, | ||
224 | .driver = { | ||
225 | .name = "hwspinlock_user", | ||
226 | .owner = THIS_MODULE, | ||
227 | .of_match_table = of_match_ptr(hwspinlock_user_of_match), | ||
228 | }, | ||
229 | }; | ||
230 | |||
231 | module_platform_driver(hwspinlock_user_driver); | ||
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 709527cd4c2e..8364d84fd696 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
@@ -1107,4 +1107,16 @@ config TOUCHSCREEN_ROHM_BU21023 | |||
1107 | To compile this driver as a module, choose M here: the | 1107 | To compile this driver as a module, choose M here: the |
1108 | module will be called bu21023_ts. | 1108 | module will be called bu21023_ts. |
1109 | 1109 | ||
1110 | config TOUCHSCREEN_LDC3001 | ||
1111 | tristate "LDC3001 ROIC based Touch screen controllers" | ||
1112 | depends on I2C | ||
1113 | help | ||
1114 | Say Y here if you have a LDC3001 plus LGD STM32F103 | ||
1115 | MCU based touchscreen controller. | ||
1116 | |||
1117 | If unsure, say N. | ||
1118 | |||
1119 | To compile this driver as a module, choose M here: the | ||
1120 | module will be called ldc3001_ts. | ||
1121 | |||
1110 | endif | 1122 | endif |
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index cbaa6abb08da..595176cb07cf 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile | |||
@@ -91,3 +91,4 @@ obj-$(CONFIG_TOUCHSCREEN_TPS6507X) += tps6507x-ts.o | |||
91 | obj-$(CONFIG_TOUCHSCREEN_ZFORCE) += zforce_ts.o | 91 | obj-$(CONFIG_TOUCHSCREEN_ZFORCE) += zforce_ts.o |
92 | obj-$(CONFIG_TOUCHSCREEN_COLIBRI_VF50) += colibri-vf50-ts.o | 92 | obj-$(CONFIG_TOUCHSCREEN_COLIBRI_VF50) += colibri-vf50-ts.o |
93 | obj-$(CONFIG_TOUCHSCREEN_ROHM_BU21023) += rohm_bu21023.o | 93 | obj-$(CONFIG_TOUCHSCREEN_ROHM_BU21023) += rohm_bu21023.o |
94 | obj-$(CONFIG_TOUCHSCREEN_LDC3001) += ldc3001_ts.o | ||
diff --git a/drivers/input/touchscreen/ldc3001_ts.c b/drivers/input/touchscreen/ldc3001_ts.c new file mode 100644 index 000000000000..6cc0798a7e08 --- /dev/null +++ b/drivers/input/touchscreen/ldc3001_ts.c | |||
@@ -0,0 +1,526 @@ | |||
1 | /* | ||
2 | * LDC3001 Touch Screen driver | ||
3 | * | ||
4 | * Copyright (C) 2013-2014 Texas Instruments Incorporated - http://www.ti.com/ | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License as | ||
8 | * published by the Free Software Foundation version 2. | ||
9 | * | ||
10 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
11 | * kind, whether express or implied; without even the implied warranty | ||
12 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | */ | ||
15 | |||
16 | |||
17 | #include <linux/module.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/kthread.h> | ||
20 | #include <linux/firmware.h> | ||
21 | #include <linux/i2c.h> | ||
22 | #include <linux/input/mt.h> | ||
23 | #include <linux/interrupt.h> | ||
24 | #include <linux/slab.h> | ||
25 | #include <linux/gpio.h> | ||
26 | #include <linux/of.h> | ||
27 | #include <linux/of_gpio.h> | ||
28 | #include <linux/of_device.h> | ||
29 | #include <linux/of_irq.h> | ||
30 | #include <linux/regmap.h> | ||
31 | |||
32 | |||
33 | #define TSC_READ_LEN 1 | ||
34 | #define DEFAULT_READ_LEN 2 /* corresponds to the ID bit-field */ | ||
35 | #define TP_READ_SIZE 3 /* co-ordinates size in bytes */ | ||
36 | #define MAX_PAYLOAD_SIZE(mt_points) ((mt_points * TP_READ_SIZE) \ | ||
37 | + DEFAULT_READ_LEN) | ||
38 | |||
39 | /* MACROS to decode data from the i2c messages */ | ||
40 | #define GET_X_POS(msg) (((((msg)[0] >> 4) & 0x0f) << 8) \ | ||
41 | | ((msg)[1])) | ||
42 | |||
43 | #define GET_Y_POS(msg) ((((msg)[0] & 0x0f)) << 8 | ((msg)[2])) | ||
44 | |||
45 | #define GET_INDICES(msg) ((((msg)[0] & 0x00ff) \ | ||
46 | | (((msg)[1]) & 0x30) << 4)) | ||
47 | |||
48 | /* i2c offsets for the tsc */ | ||
49 | #define TOUCH_DATA_ADDR 0xFA | ||
50 | #define TOUCH_DATA_COUNT_ADDR 0xF5 | ||
51 | |||
52 | /* defines a touch */ | ||
53 | struct touch_point { | ||
54 | u8 touch_id; | ||
55 | u8 state; | ||
56 | int x_pos; | ||
57 | int y_pos; | ||
58 | }; | ||
59 | |||
60 | /* platform data for the LGPhilips LDC3001 TSC */ | ||
61 | struct ldc3001_platform_data { | ||
62 | unsigned int x_size; | ||
63 | unsigned int y_size; | ||
64 | unsigned int num_mt_slots; | ||
65 | }; | ||
66 | |||
67 | /* each client has this additional data */ | ||
68 | struct ldc3001_data { | ||
69 | struct i2c_client *client; | ||
70 | struct input_dev *input_dev; | ||
71 | char phys[64]; /* device physical location */ | ||
72 | const struct ldc3001_platform_data *pdata; | ||
73 | unsigned int irq; | ||
74 | u8 *message; | ||
75 | struct touch_point *tps; | ||
76 | u8 cur_index; | ||
77 | u16 tp_fields; | ||
78 | }; | ||
79 | |||
80 | static ssize_t ldc3001_fw_version_show(struct device *dev, | ||
81 | struct device_attribute *attr, char *buf) { | ||
82 | /* FIXME: read TLC to get TS version */ | ||
83 | return scnprintf(buf, PAGE_SIZE, "1.04\n"); | ||
84 | |||
85 | } | ||
86 | static DEVICE_ATTR(fw_version, S_IRUGO, ldc3001_fw_version_show, NULL); | ||
87 | |||
88 | static struct attribute *ldc3001_attrs[] = { | ||
89 | &dev_attr_fw_version.attr, | ||
90 | NULL | ||
91 | }; | ||
92 | |||
93 | static const struct attribute_group ldc3001_attr_group = { | ||
94 | .attrs = ldc3001_attrs, | ||
95 | }; | ||
96 | |||
97 | #ifdef CONFIG_PM_SLEEP | ||
98 | static int ldc3001_i2c_ts_suspend(struct device *dev) | ||
99 | { | ||
100 | dev_dbg(dev, "%s\n", __func__); | ||
101 | return 0; | ||
102 | } | ||
103 | |||
104 | static int ldc3001_i2c_ts_resume(struct device *dev) | ||
105 | { | ||
106 | dev_dbg(dev, "%s\n", __func__); | ||
107 | |||
108 | return 0; | ||
109 | } | ||
110 | #endif | ||
111 | |||
112 | static SIMPLE_DEV_PM_OPS(ldc3001_dev_pm_ops, | ||
113 | ldc3001_i2c_ts_suspend, ldc3001_i2c_ts_resume); | ||
114 | |||
115 | |||
116 | #ifdef DEBUG | ||
117 | static void dump_touch_data(u8 *message, int len) | ||
118 | { | ||
119 | |||
120 | print_hex_dump(KERN_ERR, " \t", DUMP_PREFIX_NONE, 16, 1, | ||
121 | message, len, false); | ||
122 | } | ||
123 | |||
124 | static u16 get_touch_fields(struct ldc3001_data *data) | ||
125 | { | ||
126 | u8 *message = data->message; | ||
127 | |||
128 | pr_info("Bit field is %u\n", GET_INDICES(message)); | ||
129 | return GET_INDICES(message); | ||
130 | } | ||
131 | |||
132 | /* | ||
133 | * index - index to the read message | ||
134 | * touch_idx - touch_idx tracking id | ||
135 | */ | ||
136 | |||
137 | static void get_tpos(struct ldc3001_data *data, u8 index, u8 touch_idx) | ||
138 | { | ||
139 | u16 x, y; | ||
140 | u8 *message = &data->message[index*TP_READ_SIZE + DEFAULT_READ_LEN]; | ||
141 | |||
142 | data->tps[index].x_pos = GET_X_POS(msg); | ||
143 | data->tps[index].y_pos = GET_Y_POS(msg); | ||
144 | data->tps[index].touch_id = touch_idx; | ||
145 | |||
146 | pr_info("x %x\n", data->tps[index].x_pos); | ||
147 | pr_info("y %x\n", data->tps[index].y_pos); | ||
148 | |||
149 | } | ||
150 | |||
151 | static int ldc3001_write_reg(struct i2c_client *client, u16 reg, u16 len, | ||
152 | const void *val) | ||
153 | { | ||
154 | u8 *buf; | ||
155 | size_t count; | ||
156 | int ret; | ||
157 | |||
158 | count = len + 2; | ||
159 | buf = kmalloc(count, GFP_KERNEL); | ||
160 | if (!buf) | ||
161 | return -ENOMEM; | ||
162 | |||
163 | /* pack the 16 bit reg value to byte data */ | ||
164 | buf[0] = reg & 0xff; | ||
165 | buf[1] = (reg >> 8) & 0xff; | ||
166 | memcpy(&buf[2], val, len); | ||
167 | |||
168 | ret = i2c_master_send(client, buf, count); | ||
169 | if (ret == count) { | ||
170 | ret = 0; | ||
171 | } else { | ||
172 | if (ret >= 0) | ||
173 | ret = -EIO; | ||
174 | dev_err(&client->dev, "%s: i2c send failed (%d)\n", | ||
175 | __func__, ret); | ||
176 | } | ||
177 | |||
178 | kfree(buf); | ||
179 | return ret; | ||
180 | } | ||
181 | #endif | ||
182 | |||
183 | static int ldc3001_read_reg(struct i2c_client *client, | ||
184 | u16 reg, u16 len, void *val) | ||
185 | { | ||
186 | struct i2c_msg xfer[2]; | ||
187 | u8 buf[2]; | ||
188 | int ret; | ||
189 | |||
190 | /* pack the 16 bit reg value to byte data */ | ||
191 | buf[0] = reg & 0xff; | ||
192 | buf[1] = (reg >> 8) & 0xff; | ||
193 | |||
194 | /* Write register */ | ||
195 | xfer[0].addr = client->addr; | ||
196 | xfer[0].flags = 0; | ||
197 | xfer[0].len = 2; | ||
198 | xfer[0].buf = buf; | ||
199 | |||
200 | /* Read data */ | ||
201 | xfer[1].addr = client->addr; | ||
202 | xfer[1].flags = I2C_M_RD; | ||
203 | xfer[1].len = len; | ||
204 | xfer[1].buf = val; | ||
205 | |||
206 | ret = i2c_transfer(client->adapter, xfer, 2); | ||
207 | if (ret == 2) { | ||
208 | ret = 0; | ||
209 | } else { | ||
210 | if (ret >= 0) | ||
211 | ret = -EIO; | ||
212 | dev_err(&client->dev, "%s: i2c transfer failed (%d)\n", | ||
213 | __func__, ret); | ||
214 | } | ||
215 | |||
216 | return ret; | ||
217 | } | ||
218 | |||
219 | |||
220 | static int ldc3001_ts_read_data(struct ldc3001_data *data, int len) | ||
221 | { | ||
222 | int error; | ||
223 | struct i2c_client *client = data->client; | ||
224 | |||
225 | error = ldc3001_read_reg(client, TOUCH_DATA_ADDR, len, data->message); | ||
226 | if (error) | ||
227 | dev_err(&client->dev, "i2c_read failed %x\n", error); | ||
228 | |||
229 | return error; | ||
230 | } | ||
231 | |||
232 | static int ldc3001_ts_read_len(struct ldc3001_data *data) | ||
233 | { | ||
234 | int error; | ||
235 | u8 len = 0; | ||
236 | |||
237 | struct i2c_client *client = data->client; | ||
238 | |||
239 | error = ldc3001_read_reg(client, TOUCH_DATA_COUNT_ADDR, TSC_READ_LEN, | ||
240 | &len); | ||
241 | if (error) | ||
242 | dev_err(&client->dev, "i2c_read len failed %x\n", error); | ||
243 | |||
244 | return len; | ||
245 | } | ||
246 | |||
247 | |||
248 | |||
249 | static void ldc3001_input_touchevent(struct ldc3001_data *data) | ||
250 | { | ||
251 | u16 touch_index = 0; | ||
252 | u8 i, msg_index = 0; | ||
253 | int num_mt_slots = data->pdata->num_mt_slots; | ||
254 | struct input_dev *input_dev = data->input_dev; | ||
255 | u8 *message = data->message; | ||
256 | |||
257 | /* get valid touch ids */ | ||
258 | touch_index = GET_INDICES(message); | ||
259 | |||
260 | /* loop through all tps to process changes */ | ||
261 | for (i = 0; i < num_mt_slots; i++) { | ||
262 | |||
263 | /* tracking id has a touch event */ | ||
264 | if (touch_index & (1 << i)) { | ||
265 | message = | ||
266 | &data->message[msg_index * TP_READ_SIZE + DEFAULT_READ_LEN]; | ||
267 | |||
268 | /* decode the x and y co-ordinates */ | ||
269 | data->tps[i].x_pos = GET_X_POS(message); | ||
270 | data->tps[i].y_pos = GET_Y_POS(message); | ||
271 | |||
272 | /* update state and move to the next message */ | ||
273 | data->tps[i].state = 1; | ||
274 | msg_index++; | ||
275 | |||
276 | /* report the touch event */ | ||
277 | input_mt_slot(input_dev, i); | ||
278 | input_mt_report_slot_state(input_dev, | ||
279 | MT_TOOL_FINGER, data->tps[i].state); | ||
280 | input_report_abs(input_dev, ABS_MT_POSITION_X, | ||
281 | data->tps[i].x_pos); | ||
282 | input_report_abs(input_dev, ABS_MT_POSITION_Y, | ||
283 | data->tps[i].y_pos); | ||
284 | |||
285 | } else if (data->tps[i].state == 1) { | ||
286 | /* this is a pen release event */ | ||
287 | data->tps[i].state = 0; | ||
288 | input_mt_slot(input_dev, i); | ||
289 | input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, | ||
290 | data->tps[i].state); | ||
291 | } | ||
292 | } | ||
293 | |||
294 | /* send sync event */ | ||
295 | input_mt_report_pointer_emulation(data->input_dev, false); | ||
296 | input_sync(input_dev); | ||
297 | } | ||
298 | |||
299 | |||
300 | static irqreturn_t ldc3001_ts_interrupt(int irq, void *dev_id) | ||
301 | { | ||
302 | struct ldc3001_data *data = (struct ldc3001_data *)dev_id; | ||
303 | int read_len; | ||
304 | |||
305 | /* FIXME: need to figure out why this is required */ | ||
306 | disable_irq_nosync(irq); | ||
307 | |||
308 | read_len = ldc3001_ts_read_len(data); | ||
309 | |||
310 | /* reset touchid fields */ | ||
311 | data->message[0] = 0x0; | ||
312 | data->message[1] = 0x0; | ||
313 | |||
314 | if (read_len > DEFAULT_READ_LEN) | ||
315 | /* fill the message array with data read from tsc */ | ||
316 | ldc3001_ts_read_data(data, read_len); | ||
317 | |||
318 | ldc3001_input_touchevent(data); | ||
319 | enable_irq(irq); | ||
320 | |||
321 | return IRQ_HANDLED; | ||
322 | } | ||
323 | |||
324 | int ldc3001_of_populate(struct i2c_client *client, | ||
325 | struct ldc3001_platform_data *pdata) | ||
326 | { | ||
327 | struct device_node *node = client->dev.of_node; | ||
328 | unsigned int val; | ||
329 | int ret = -EINVAL; | ||
330 | |||
331 | ret = of_property_read_u32(node, "res-x", &val); | ||
332 | if (ret) | ||
333 | goto error; | ||
334 | pdata->x_size = val; | ||
335 | |||
336 | ret = of_property_read_u32(node, "res-y", &val); | ||
337 | if (ret) | ||
338 | goto error; | ||
339 | |||
340 | pdata->y_size = val; | ||
341 | |||
342 | ret = of_property_read_u32(node, "max-touch-points", &val); | ||
343 | if (ret) | ||
344 | goto error; | ||
345 | |||
346 | pdata->num_mt_slots = val; | ||
347 | |||
348 | error: | ||
349 | return ret; | ||
350 | } | ||
351 | |||
352 | static const struct of_device_id ldc3001_dt_ids[] = { | ||
353 | { .compatible = "lgphilips,ldc3001"}, | ||
354 | { /* sentinel */ } | ||
355 | }; | ||
356 | |||
357 | static int ldc3001_probe(struct i2c_client *client, | ||
358 | const struct i2c_device_id *idev_id) | ||
359 | { | ||
360 | struct device_node *node = client->dev.of_node; | ||
361 | struct ldc3001_platform_data *pdata; | ||
362 | struct ldc3001_data *data; | ||
363 | struct input_dev *input_dev; | ||
364 | const struct of_device_id *match; | ||
365 | int error; | ||
366 | |||
367 | match = of_match_device(of_match_ptr(ldc3001_dt_ids), &client->dev); | ||
368 | if (match) { | ||
369 | pdata = devm_kzalloc(&client->dev, | ||
370 | sizeof(struct ldc3001_platform_data), GFP_KERNEL); | ||
371 | if (!pdata) | ||
372 | return -ENOMEM; | ||
373 | |||
374 | /* get dt values to populate platform data */ | ||
375 | error = ldc3001_of_populate(client, pdata); | ||
376 | if (error) | ||
377 | return -EINVAL; | ||
378 | |||
379 | } else { | ||
380 | pdata = client->dev.platform_data; | ||
381 | if (!pdata) { | ||
382 | dev_err(&client->dev, "platform data not populated\n"); | ||
383 | return -EINVAL; | ||
384 | } | ||
385 | } | ||
386 | |||
387 | data = devm_kzalloc(&client->dev, | ||
388 | sizeof(struct ldc3001_data), GFP_KERNEL); | ||
389 | |||
390 | if (!data) { | ||
391 | error = -ENOMEM; | ||
392 | goto err_exit; | ||
393 | } | ||
394 | |||
395 | data->tps = devm_kzalloc(&client->dev, | ||
396 | sizeof(struct touch_point) * pdata->num_mt_slots, GFP_KERNEL); | ||
397 | |||
398 | if (!data->tps) { | ||
399 | error = -ENOMEM; | ||
400 | goto err_exit; | ||
401 | } | ||
402 | |||
403 | data->message = devm_kzalloc(&client->dev, | ||
404 | (sizeof(u8) * MAX_PAYLOAD_SIZE(pdata->num_mt_slots)), | ||
405 | GFP_KERNEL); | ||
406 | if (!data->message) { | ||
407 | error = -ENOMEM; | ||
408 | goto err_exit; | ||
409 | } | ||
410 | |||
411 | input_dev = devm_input_allocate_device(&client->dev); | ||
412 | |||
413 | if (!input_dev) { | ||
414 | error = -ENOMEM; | ||
415 | goto err_exit; | ||
416 | } | ||
417 | |||
418 | input_dev->name = "LDC 3001 TouchScreen Controller"; | ||
419 | |||
420 | snprintf(data->phys, sizeof(data->phys), "i2c-%u-%04x/input0", | ||
421 | client->adapter->nr, client->addr); | ||
422 | |||
423 | input_dev->phys = data->phys; | ||
424 | |||
425 | input_dev->dev.parent = &client->dev; | ||
426 | data->client = client; | ||
427 | data->input_dev = input_dev; | ||
428 | data->pdata = pdata; | ||
429 | |||
430 | input_set_drvdata(input_dev, data); | ||
431 | i2c_set_clientdata(client, data); | ||
432 | |||
433 | /*TODO: Need to poke the tlc chip to read revision of the TSC chip */ | ||
434 | |||
435 | __set_bit(EV_ABS, input_dev->evbit); | ||
436 | __set_bit(EV_KEY, input_dev->evbit); | ||
437 | __set_bit(BTN_TOUCH, input_dev->keybit); | ||
438 | |||
439 | /* For single touch */ | ||
440 | input_set_abs_params(input_dev, ABS_X, | ||
441 | 0, pdata->x_size, 0, 0); | ||
442 | input_set_abs_params(input_dev, ABS_Y, | ||
443 | 0, pdata->y_size, 0, 0); | ||
444 | |||
445 | /* For multi touch */ | ||
446 | error = input_mt_init_slots(input_dev, pdata->num_mt_slots, 0); | ||
447 | |||
448 | if (error) | ||
449 | goto err_exit; | ||
450 | |||
451 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, | ||
452 | 0, pdata->x_size, 0, 0); | ||
453 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, | ||
454 | 0, pdata->y_size, 0, 0); | ||
455 | |||
456 | data->irq = irq_of_parse_and_map(node, 0); | ||
457 | if (data->irq) { | ||
458 | error = devm_request_threaded_irq(&client->dev, data->irq, | ||
459 | NULL, ldc3001_ts_interrupt, | ||
460 | IRQF_ONESHOT | IRQF_TRIGGER_HIGH, | ||
461 | dev_name(&client->dev), data); | ||
462 | |||
463 | if (error) { | ||
464 | dev_err(&client->dev, "failed to register interrupt\n"); | ||
465 | goto cleanup_exit; | ||
466 | } | ||
467 | } else { | ||
468 | dev_err(&client->dev, | ||
469 | "failed registering irq = %d\n", data->irq); | ||
470 | error = -EINVAL; | ||
471 | goto cleanup_exit; | ||
472 | } | ||
473 | |||
474 | error = input_register_device(input_dev); | ||
475 | if (error) | ||
476 | input_free_device(input_dev); | ||
477 | else { | ||
478 | error = sysfs_create_group(&client->dev.kobj, | ||
479 | &ldc3001_attr_group); | ||
480 | return error; | ||
481 | } | ||
482 | |||
483 | cleanup_exit: | ||
484 | input_mt_destroy_slots(input_dev); | ||
485 | err_exit: | ||
486 | return error; | ||
487 | } | ||
488 | |||
489 | static int ldc3001_remove(struct i2c_client *client) | ||
490 | { | ||
491 | |||
492 | struct ldc3001_data *data = | ||
493 | (struct ldc3001_data *)i2c_get_clientdata(client); | ||
494 | struct input_dev *input_dev = data->input_dev; | ||
495 | |||
496 | sysfs_remove_group(&client->dev.kobj, &ldc3001_attr_group); | ||
497 | input_unregister_device(input_dev); | ||
498 | |||
499 | return 0; | ||
500 | } | ||
501 | |||
502 | static const struct i2c_device_id ldc3001_i2c_id[] = { | ||
503 | {"ldc3001", 0}, | ||
504 | { } | ||
505 | }; | ||
506 | |||
507 | MODULE_DEVICE_TABLE(i2c, ldc3001_i2c_id); | ||
508 | |||
509 | static struct i2c_driver ldc3001_i2c_driver = { | ||
510 | .driver = { | ||
511 | .owner = THIS_MODULE, | ||
512 | .name = "ldc3001", | ||
513 | .pm = &ldc3001_dev_pm_ops, | ||
514 | .of_match_table = ldc3001_dt_ids, | ||
515 | }, | ||
516 | .probe = ldc3001_probe, | ||
517 | .remove = ldc3001_remove, | ||
518 | .id_table = ldc3001_i2c_id, | ||
519 | }; | ||
520 | |||
521 | module_i2c_driver(ldc3001_i2c_driver); | ||
522 | |||
523 | MODULE_AUTHOR("Subramaniam Chanderashekarapuram <subramaniam.ca@ti.com>"); | ||
524 | MODULE_DESCRIPTION("LDC3001 I2C Touchscreen driver"); | ||
525 | MODULE_LICENSE("GPL"); | ||
526 | MODULE_ALIAS("i2c:ldc3001"); | ||
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index 9aa2f6aa79ad..1cb286a0afb0 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig | |||
@@ -317,6 +317,17 @@ config VIDEO_TVP5150 | |||
317 | To compile this driver as a module, choose M here: the | 317 | To compile this driver as a module, choose M here: the |
318 | module will be called tvp5150. | 318 | module will be called tvp5150. |
319 | 319 | ||
320 | config VIDEO_TVP5158 | ||
321 | tristate "Analog video decoder TVP5158 support NTSC/PAL" | ||
322 | depends on I2C && VIDEO_V4L2 | ||
323 | depends on MEDIA_CAMERA_SUPPORT | ||
324 | ---help--- | ||
325 | This is a Video4Linux2 subdevice driver for the TVP5158 | ||
326 | NTSC/PAL video decoder. | ||
327 | |||
328 | To compile this driver as a module, choose M here: the | ||
329 | module will be called tvp5158. | ||
330 | |||
320 | config VIDEO_TVP7002 | 331 | config VIDEO_TVP7002 |
321 | tristate "Texas Instruments TVP7002 video decoder" | 332 | tristate "Texas Instruments TVP7002 video decoder" |
322 | depends on VIDEO_V4L2 && I2C | 333 | depends on VIDEO_V4L2 && I2C |
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index 74f4e962bef3..03b25c0d0cbe 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile | |||
@@ -39,6 +39,7 @@ obj-$(CONFIG_VIDEO_THS7303) += ths7303.o | |||
39 | obj-$(CONFIG_VIDEO_THS8200) += ths8200.o | 39 | obj-$(CONFIG_VIDEO_THS8200) += ths8200.o |
40 | obj-$(CONFIG_VIDEO_TVP5150) += tvp5150.o | 40 | obj-$(CONFIG_VIDEO_TVP5150) += tvp5150.o |
41 | obj-$(CONFIG_VIDEO_TVP514X) += tvp514x.o | 41 | obj-$(CONFIG_VIDEO_TVP514X) += tvp514x.o |
42 | obj-$(CONFIG_VIDEO_TVP5158) += tvp5158.o | ||
42 | obj-$(CONFIG_VIDEO_TVP7002) += tvp7002.o | 43 | obj-$(CONFIG_VIDEO_TVP7002) += tvp7002.o |
43 | obj-$(CONFIG_VIDEO_TW2804) += tw2804.o | 44 | obj-$(CONFIG_VIDEO_TW2804) += tw2804.o |
44 | obj-$(CONFIG_VIDEO_TW9903) += tw9903.o | 45 | obj-$(CONFIG_VIDEO_TW9903) += tw9903.o |
diff --git a/drivers/media/i2c/tvp5158.c b/drivers/media/i2c/tvp5158.c new file mode 100644 index 000000000000..ae01a763a5e1 --- /dev/null +++ b/drivers/media/i2c/tvp5158.c | |||
@@ -0,0 +1,738 @@ | |||
1 | /* | ||
2 | * TI TVP5158 V4L2 subdevice driver | ||
3 | * | ||
4 | * Copyright (C) 2016 Texas Instruments, Inc. | ||
5 | * Sathishkumar S <sathish.omap@gmail.com> | ||
6 | * Nikhil Devshatwar, <nikhil.nd@ti.com> | ||
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 | */ | ||
13 | |||
14 | #include <linux/delay.h> | ||
15 | #include <linux/i2c.h> | ||
16 | #include <linux/gpio.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/regulator/consumer.h> | ||
20 | #include <linux/regmap.h> | ||
21 | #include <linux/slab.h> | ||
22 | #include <linux/v4l2-mediabus.h> | ||
23 | #include <linux/videodev2.h> | ||
24 | |||
25 | #include <media/soc_camera.h> | ||
26 | #include <media/v4l2-async.h> | ||
27 | #include <media/v4l2-common.h> | ||
28 | #include <media/v4l2-ctrls.h> | ||
29 | |||
30 | #include <linux/pm_runtime.h> | ||
31 | |||
32 | #include <linux/of_gpio.h> | ||
33 | #include <linux/of_device.h> | ||
34 | |||
35 | /* Debug functions */ | ||
36 | static bool debug; | ||
37 | module_param(debug, bool, 0644); | ||
38 | MODULE_PARM_DESC(debug, "Debug level (0-2)"); | ||
39 | |||
40 | /* VBUS Register Address (24-bit), VBUS Register value (8-bit) */ | ||
41 | struct vbus_addr_value { | ||
42 | unsigned int addr; | ||
43 | unsigned char val; | ||
44 | }; | ||
45 | |||
46 | struct vbus_addr_value vbus_addr_value_set[] = { | ||
47 | {0x00403E50, 0x40}, | ||
48 | {0x00403E51, 0x00}, | ||
49 | {0x00403E52, 0x40}, | ||
50 | {0x00403E53, 0x00}, | ||
51 | {0x00403E54, 0x44}, | ||
52 | {0x00403E55, 0x23}, | ||
53 | {0x00403E56, 0x38}, | ||
54 | {0x00403E57, 0x10}, | ||
55 | {0x00403E58, 0x53}, | ||
56 | {0x00403E59, 0x23}, | ||
57 | {0x00403E5A, 0x02}, | ||
58 | {0x00403E5B, 0x00}, | ||
59 | {0x00403E5C, 0x20}, | ||
60 | {0x00403E5D, 0x00}, | ||
61 | {0x00403E5E, 0x04}, | ||
62 | {0x00403E5F, 0x04}, | ||
63 | {0x00403E60, 0x04}, | ||
64 | {0x00403E61, 0x04}, | ||
65 | {0x00403E62, 0x10}, | ||
66 | {0x00403E63, 0xF8}, | ||
67 | {0x00403E64, 0x30}, | ||
68 | {0x00403E65, 0x20}, | ||
69 | {0x00403E66, 0x30}, | ||
70 | {0x00403E67, 0x3F}, | ||
71 | {0x00403E68, 0x3F}, | ||
72 | {0x00403E69, 0x3F}, | ||
73 | {0x00403E6A, 0x0C}, | ||
74 | {0x00403E6B, 0x0C}, | ||
75 | {0x00403E6C, 0x80}, | ||
76 | {0x00403E6D, 0x80}, | ||
77 | {0x00403E6E, 0x08}, | ||
78 | {0x00403E6F, 0x08}, | ||
79 | {0x00403E70, 0x08}, | ||
80 | {0x00403E71, 0x30}, | ||
81 | {0x00403E72, 0x08}, | ||
82 | {0x00403E73, 0x04}, | ||
83 | {0x00403E74, 0x00}, | ||
84 | {0x00403E75, 0x10}, | ||
85 | {0x00403E76, 0x00}, | ||
86 | {0x00403E77, 0x00}, | ||
87 | {0x00403E78, 0x38}, | ||
88 | {0x00403E79, 0x00}, | ||
89 | {0x00403E7A, 0x55}, | ||
90 | {0x00403E7B, 0x03}, | ||
91 | {0x00403E7C, 0x03}, | ||
92 | {0x00403E7D, 0x00}, | ||
93 | {0x00403E7E, 0x03}, | ||
94 | {0x00403E7F, 0x00}, | ||
95 | {0x00403E80, 0x30}, | ||
96 | {0x00403E81, 0x30}, | ||
97 | {0x00403E82, 0x18}, | ||
98 | {0x00403E83, 0x0C}, | ||
99 | {0x00403E95, 0x00}, | ||
100 | {0x00403E96, 0x00}, | ||
101 | {0x00403E9B, 0x3F}, | ||
102 | {0x00403EA2, 0x0C}, | ||
103 | {0x00403EA3, 0x10}, | ||
104 | {0x00403EA6, 0x0C}, | ||
105 | {0x00403EA7, 0x10}, | ||
106 | {0x00403EA8, 0x44}, | ||
107 | {0x00403EA9, 0x00}, | ||
108 | }; | ||
109 | static bool vbus_prog = 1; | ||
110 | static int | ||
111 | tvp5158_of_probe(struct i2c_client *client, struct device_node *node); | ||
112 | static int | ||
113 | tvp5158_init_gpios(struct i2c_client *client); | ||
114 | static int | ||
115 | tvp5158_set_default(struct i2c_client *client, unsigned char core); | ||
116 | static enum tvp5158_std | ||
117 | tvp5158_get_video_std(struct i2c_client *client, unsigned char core); | ||
118 | static void | ||
119 | tvp5158_start_streaming(struct i2c_client *client, unsigned char core); | ||
120 | static int | ||
121 | tvp5158_set_int_regs(struct i2c_client *client, struct vbus_addr_value *reg, | ||
122 | int cnt); | ||
123 | |||
124 | #define REG_STAUS_1 0x00 | ||
125 | #define REG_STAUS_2 0x01 | ||
126 | #define REG_VID_STAND 0x0C | ||
127 | #define REG_CHIPID_MSB 0x08 | ||
128 | #define REG_CHIPID_LSB 0x09 | ||
129 | #define REG_AVD_CTRL_1 0xB0 | ||
130 | #define REG_AVD_CTRL_2 0xB1 | ||
131 | #define REG_OFM_CTRL 0xB2 | ||
132 | #define REG_DEC_RD_EN 0xFF | ||
133 | #define REG_DEC_WR_EN 0xFE | ||
134 | #define REG_VBUS_1 0xE8 | ||
135 | #define REG_VBUS_2 0xE9 | ||
136 | #define REG_VBUS_3 0xEA | ||
137 | #define REG_VBUS_DATA 0xE0 | ||
138 | |||
139 | #define TVP_CORE_ALL 0x0F | ||
140 | #define TVP_DECODER_1 (1<<0) | ||
141 | /* Non interleaved */ | ||
142 | #define TVP_INTERLEAVE_MODE_NON (0<<6) | ||
143 | #define TVP_INTERLEAVE_MODE_PIX (1<<6) | ||
144 | #define TVP_INTERLEAVE_MODE_LINE (2<<6) | ||
145 | /* Number of time multiplexed channels = 0 */ | ||
146 | #define TVP_CH_MUX_NUMBER (2<<4) | ||
147 | /* ITU BT 656 8 bit */ | ||
148 | #define TVP_OUTPUT_TYPE (0<<3) | ||
149 | /* Single stage */ | ||
150 | #define TVP_VCS_ID (0<<2) | ||
151 | /* D1 */ | ||
152 | #define TVP_VID_RES (0<<0) | ||
153 | |||
154 | #define TVP_ENABLE_DITHERING (1<<4) | ||
155 | #define TVP_VID_DET_SAVEAV_EN (1<<0) | ||
156 | |||
157 | #define TVP_VIDEO_PORT_ENABLE (1<<0) | ||
158 | #define TVP_OUT_CLK_P_EN (1<<2) | ||
159 | #define TVP_FIELD_RATE (1<<5) | ||
160 | #define TVP_SIGNAL_PRESENT (1<<7) | ||
161 | #define TVP_VIDEO_STANDARD_MASK (0x07) | ||
162 | |||
163 | /* Number of pixels and number of lines per frame for different standards */ | ||
164 | #define NTSC_NUM_ACTIVE_PIXELS (720) | ||
165 | #define NTSC_NUM_ACTIVE_LINES (480) | ||
166 | #define PAL_NUM_ACTIVE_PIXELS (720) | ||
167 | #define PAL_NUM_ACTIVE_LINES (576) | ||
168 | |||
169 | #define MAX_NUM_GPIOS 3 | ||
170 | |||
171 | struct tvp5158_color_format { | ||
172 | u32 code; | ||
173 | enum v4l2_colorspace colorspace; | ||
174 | }; | ||
175 | |||
176 | static const struct tvp5158_color_format tvp5158_cfmts[] = { | ||
177 | { | ||
178 | .code = MEDIA_BUS_FMT_UYVY8_2X8, | ||
179 | .colorspace = V4L2_COLORSPACE_SMPTE170M, | ||
180 | }, | ||
181 | }; | ||
182 | |||
183 | /* enum tvp5158_std - enum for supported standards */ | ||
184 | enum tvp5158_std { | ||
185 | STD_NTSC_MJ = 0, | ||
186 | STD_PAL_BDGHIN, | ||
187 | STD_INVALID | ||
188 | }; | ||
189 | |||
190 | /** | ||
191 | * struct tvp5158_std_info - Structure to store standard information | ||
192 | * @width: Line width in pixels | ||
193 | * @height:Number of active lines | ||
194 | * @standard: v4l2 standard structure information | ||
195 | */ | ||
196 | struct tvp5158_std_info { | ||
197 | unsigned long width; | ||
198 | unsigned long height; | ||
199 | struct v4l2_standard standard; | ||
200 | }; | ||
201 | |||
202 | enum tvp5158_signal_present { | ||
203 | TVP5158_SIGNAL_DEAD = 0, | ||
204 | TVP5158_SIGNAL_PRESENT | ||
205 | }; | ||
206 | struct tvp5158_priv { | ||
207 | struct v4l2_subdev subdev; | ||
208 | struct v4l2_mbus_framefmt format; | ||
209 | enum tvp5158_std current_std; | ||
210 | |||
211 | struct gpio mux_gpios[MAX_NUM_GPIOS]; | ||
212 | int num_gpios; | ||
213 | }; | ||
214 | |||
215 | static const struct tvp5158_std_info std_list[] = { | ||
216 | [STD_NTSC_MJ] = { | ||
217 | .width = NTSC_NUM_ACTIVE_PIXELS, | ||
218 | .height = NTSC_NUM_ACTIVE_LINES, | ||
219 | .standard = { | ||
220 | .index = 0, | ||
221 | .id = V4L2_STD_NTSC, | ||
222 | .name = "NTSC", | ||
223 | .frameperiod = {1001, 30000}, | ||
224 | .framelines = 525 | ||
225 | }, | ||
226 | }, | ||
227 | |||
228 | [STD_PAL_BDGHIN] = { | ||
229 | .width = PAL_NUM_ACTIVE_PIXELS, | ||
230 | .height = PAL_NUM_ACTIVE_LINES, | ||
231 | .standard = { | ||
232 | .index = 1, | ||
233 | .id = V4L2_STD_PAL, | ||
234 | .name = "PAL", | ||
235 | .frameperiod = {1001, 25000}, | ||
236 | .framelines = 625 | ||
237 | }, | ||
238 | }, | ||
239 | }; | ||
240 | |||
241 | static struct tvp5158_priv *to_tvp5158(const struct i2c_client *client) | ||
242 | { | ||
243 | return container_of(i2c_get_clientdata(client), struct tvp5158_priv, | ||
244 | subdev); | ||
245 | } | ||
246 | |||
247 | |||
248 | static int tvp5158_read(struct i2c_client *client, unsigned char addr) | ||
249 | { | ||
250 | unsigned char buffer[1]; | ||
251 | int rc; | ||
252 | |||
253 | buffer[0] = addr; | ||
254 | |||
255 | rc = i2c_master_send(client, buffer, 1); | ||
256 | if (rc < 0) { | ||
257 | dev_err(&client->dev, "i2c i/o error: rc == %d (should be 1)\n" | ||
258 | , rc); | ||
259 | return rc; | ||
260 | } | ||
261 | |||
262 | rc = i2c_master_recv(client, buffer, 1); | ||
263 | if (rc < 0) { | ||
264 | dev_err(&client->dev, "i2c i/o error: rc == %d (should be 1)\n" | ||
265 | , rc); | ||
266 | return rc; | ||
267 | } | ||
268 | |||
269 | return buffer[0]; | ||
270 | } | ||
271 | static inline void tvp5158_write(struct i2c_client *client, unsigned char addr, | ||
272 | unsigned char value) | ||
273 | { | ||
274 | unsigned char buffer[2]; | ||
275 | int rc; | ||
276 | |||
277 | buffer[0] = addr; | ||
278 | buffer[1] = value; | ||
279 | rc = i2c_master_send(client, buffer, 2); | ||
280 | if (rc != 2) | ||
281 | dev_err(&client->dev, "i2c i/o error: rc == %d (should be 2)\n" | ||
282 | , rc); | ||
283 | } | ||
284 | |||
285 | /** | ||
286 | * tvp5158_s_stream() - V4L2 decoder i/f handler for s_stream | ||
287 | * @sd: pointer to standard V4L2 sub-device structure | ||
288 | * @enable: streaming enable or disable | ||
289 | * | ||
290 | * Sets streaming to enable or disable. | ||
291 | */ | ||
292 | static int tvp5158_s_stream(struct v4l2_subdev *sd, int enable) | ||
293 | { | ||
294 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
295 | |||
296 | tvp5158_init_gpios(client); | ||
297 | |||
298 | if (enable) { | ||
299 | if (vbus_prog == 1) | ||
300 | /* VBUS address value setting */ | ||
301 | tvp5158_set_int_regs(client, vbus_addr_value_set, | ||
302 | ARRAY_SIZE(vbus_addr_value_set)); | ||
303 | tvp5158_start_streaming(client, TVP_CORE_ALL); | ||
304 | } else { | ||
305 | tvp5158_write(client, REG_OFM_CTRL, 0x0); | ||
306 | } | ||
307 | |||
308 | return 0; | ||
309 | } | ||
310 | |||
311 | /** | ||
312 | * tvp5158_querystd() - V4L2 decoder interface handler for querystd | ||
313 | * @sd: pointer to standard V4L2 sub-device structure | ||
314 | * @std_id: standard V4L2 std_id ioctl enum | ||
315 | * | ||
316 | * Returns the current standard detected by TVP5146/47. If no active input is | ||
317 | * detected then *std_id is set to 0 and the function returns 0. | ||
318 | */ | ||
319 | static int tvp5158_querystd(struct v4l2_subdev *sd, v4l2_std_id *std_id) | ||
320 | { | ||
321 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
322 | struct tvp5158_priv *priv = to_tvp5158(client); | ||
323 | |||
324 | if (std_id == NULL) | ||
325 | return -EINVAL; | ||
326 | *std_id = V4L2_STD_UNKNOWN; | ||
327 | |||
328 | tvp5158_get_video_std(client, TVP_CORE_ALL); | ||
329 | if (priv->current_std == STD_INVALID) | ||
330 | return -ENODEV; | ||
331 | *std_id = std_list[priv->current_std].standard.id; | ||
332 | |||
333 | return 0; | ||
334 | } | ||
335 | |||
336 | /** | ||
337 | * tvp5158_g_parm() - V4L2 decoder interface handler for g_parm | ||
338 | * @sd: pointer to standard V4L2 sub-device structure | ||
339 | * @a: pointer to standard V4L2 VIDIOC_G_PARM ioctl structure | ||
340 | * | ||
341 | * Returns the decoder's video CAPTURE parameters. | ||
342 | */ | ||
343 | static int tvp5158_g_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms) | ||
344 | { | ||
345 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
346 | struct tvp5158_priv *priv = to_tvp5158(client); | ||
347 | struct v4l2_captureparm *cparm; | ||
348 | enum tvp5158_std current_std; | ||
349 | |||
350 | if (parms == NULL || parms->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
351 | return -EINVAL; | ||
352 | |||
353 | tvp5158_get_video_std(client, TVP_CORE_ALL); | ||
354 | if (priv->current_std == STD_INVALID) | ||
355 | return -ENODEV; | ||
356 | |||
357 | /* get the current standard */ | ||
358 | current_std = priv->current_std; | ||
359 | cparm = &parms->parm.capture; | ||
360 | cparm->capability = V4L2_CAP_TIMEPERFRAME; | ||
361 | cparm->timeperframe = | ||
362 | std_list[current_std].standard.frameperiod; | ||
363 | |||
364 | return 0; | ||
365 | } | ||
366 | |||
367 | /** | ||
368 | * tvp5158_s_parm() - V4L2 decoder interface handler for s_parm | ||
369 | * @sd: pointer to standard V4L2 sub-device structure | ||
370 | * @a: pointer to standard V4L2 VIDIOC_S_PARM ioctl structure | ||
371 | * | ||
372 | * Configures the decoder to use the input parameters, if possible. If | ||
373 | * not possible, returns the appropriate error code. | ||
374 | */ | ||
375 | static int tvp5158_s_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms) | ||
376 | { | ||
377 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
378 | struct tvp5158_priv *priv = to_tvp5158(client); | ||
379 | struct v4l2_fract *timeperframe; | ||
380 | enum tvp5158_std current_std; | ||
381 | |||
382 | if (parms == NULL || parms->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
383 | return -EINVAL; | ||
384 | |||
385 | timeperframe = &parms->parm.capture.timeperframe; | ||
386 | |||
387 | /* get the current standard */ | ||
388 | current_std = priv->current_std; | ||
389 | |||
390 | *timeperframe = | ||
391 | std_list[current_std].standard.frameperiod; | ||
392 | |||
393 | return 0; | ||
394 | } | ||
395 | |||
396 | static int tvp5158_get_fmt(struct v4l2_subdev *sd, | ||
397 | struct v4l2_subdev_pad_config *cfg, | ||
398 | struct v4l2_subdev_format *fmt) | ||
399 | { | ||
400 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
401 | struct tvp5158_priv *priv = to_tvp5158(client); | ||
402 | struct v4l2_mbus_framefmt *mf; | ||
403 | enum tvp5158_std current_std; | ||
404 | |||
405 | tvp5158_get_video_std(client, TVP_CORE_ALL); | ||
406 | current_std = priv->current_std; | ||
407 | if (current_std == STD_INVALID) | ||
408 | return -EINVAL; | ||
409 | |||
410 | switch (fmt->which) { | ||
411 | case V4L2_SUBDEV_FORMAT_TRY: | ||
412 | mf = v4l2_subdev_get_try_format(sd, cfg, 0); | ||
413 | break; | ||
414 | case V4L2_SUBDEV_FORMAT_ACTIVE: | ||
415 | mf = &priv->format; | ||
416 | break; | ||
417 | default: | ||
418 | return -EINVAL; | ||
419 | } | ||
420 | |||
421 | mf->width = std_list[current_std].width; | ||
422 | mf->height = std_list[current_std].height / 2; | ||
423 | fmt->format = *mf; | ||
424 | |||
425 | return 0; | ||
426 | } | ||
427 | |||
428 | static int tvp5158_set_fmt(struct v4l2_subdev *sd, | ||
429 | struct v4l2_subdev_pad_config *cfg, | ||
430 | struct v4l2_subdev_format *fmt) | ||
431 | |||
432 | { | ||
433 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
434 | struct tvp5158_priv *priv = to_tvp5158(client); | ||
435 | int ret; | ||
436 | |||
437 | if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) { | ||
438 | |||
439 | ret = tvp5158_get_fmt(sd, cfg, fmt); | ||
440 | if (ret) | ||
441 | return ret; | ||
442 | |||
443 | priv->format = fmt->format; | ||
444 | } | ||
445 | |||
446 | return 0; | ||
447 | } | ||
448 | |||
449 | static int tvp5158_enum_mbus_code(struct v4l2_subdev *sd, | ||
450 | struct v4l2_subdev_pad_config *cfg, | ||
451 | struct v4l2_subdev_mbus_code_enum *code) | ||
452 | { | ||
453 | if (code->index >= ARRAY_SIZE(tvp5158_cfmts)) | ||
454 | return -EINVAL; | ||
455 | |||
456 | code->code = tvp5158_cfmts[code->index].code; | ||
457 | |||
458 | return 0; | ||
459 | } | ||
460 | |||
461 | static int tvp5158_enum_frame_size(struct v4l2_subdev *sd, | ||
462 | struct v4l2_subdev_pad_config *cfg, | ||
463 | struct v4l2_subdev_frame_size_enum *fse) | ||
464 | { | ||
465 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
466 | struct tvp5158_priv *priv = to_tvp5158(client); | ||
467 | enum tvp5158_std std; | ||
468 | |||
469 | if (fse->index >= 1) | ||
470 | return -EINVAL; | ||
471 | if (priv->current_std == STD_INVALID) | ||
472 | tvp5158_get_video_std(client, TVP_CORE_ALL); | ||
473 | if (priv->current_std == STD_INVALID) | ||
474 | return -ENODEV; | ||
475 | |||
476 | std = priv->current_std; | ||
477 | fse->code = priv->format.code; | ||
478 | |||
479 | fse->max_width = fse->min_width = std_list[std].width; | ||
480 | fse->max_height = fse->min_height = std_list[std].height; | ||
481 | |||
482 | return 0; | ||
483 | } | ||
484 | |||
485 | static int tvp5158_of_probe(struct i2c_client *client, | ||
486 | struct device_node *node) | ||
487 | { | ||
488 | struct tvp5158_priv *priv = to_tvp5158(client); | ||
489 | struct gpio *gpios = &priv->mux_gpios[0]; | ||
490 | unsigned int flags; | ||
491 | int i, gpio; | ||
492 | |||
493 | /* Iterate over all the gpios in the device tree | ||
494 | * ENOENT is returned when trying to access last + 1 gpio | ||
495 | */ | ||
496 | for (i = 0; i < MAX_NUM_GPIOS; i++) { | ||
497 | |||
498 | gpio = of_get_named_gpio_flags(node, "mux-gpios", i, &flags); | ||
499 | if (gpio_is_valid(gpio)) { | ||
500 | gpios[i].gpio = gpio; | ||
501 | gpios[i].flags = (flags & OF_GPIO_ACTIVE_LOW) ? | ||
502 | GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH; | ||
503 | gpios[i].label = client->name; | ||
504 | } else if (gpio == -ENOENT) { | ||
505 | break; | ||
506 | } else { | ||
507 | return gpio; | ||
508 | } | ||
509 | } | ||
510 | priv->num_gpios = i; | ||
511 | return 0; | ||
512 | } | ||
513 | |||
514 | static int tvp5158_init_gpios(struct i2c_client *client) | ||
515 | { | ||
516 | struct tvp5158_priv *priv = to_tvp5158(client); | ||
517 | int ret = 0; | ||
518 | |||
519 | ret = gpio_request_array(priv->mux_gpios, priv->num_gpios); | ||
520 | if (ret) | ||
521 | goto done; | ||
522 | gpio_free_array(priv->mux_gpios, priv->num_gpios); | ||
523 | |||
524 | done: | ||
525 | return ret; | ||
526 | } | ||
527 | |||
528 | static struct v4l2_subdev_video_ops tvp5158_video_ops = { | ||
529 | .querystd = tvp5158_querystd, | ||
530 | .g_parm = tvp5158_g_parm, | ||
531 | .s_parm = tvp5158_s_parm, | ||
532 | .s_stream = tvp5158_s_stream, | ||
533 | }; | ||
534 | |||
535 | static struct v4l2_subdev_pad_ops tvp5158_pad_ops = { | ||
536 | .enum_mbus_code = tvp5158_enum_mbus_code, | ||
537 | .enum_frame_size = tvp5158_enum_frame_size, | ||
538 | .get_fmt = tvp5158_get_fmt, | ||
539 | .set_fmt = tvp5158_set_fmt, | ||
540 | }; | ||
541 | |||
542 | static struct v4l2_subdev_ops tvp5158_subdev_ops = { | ||
543 | .video = &tvp5158_video_ops, | ||
544 | .pad = &tvp5158_pad_ops, | ||
545 | }; | ||
546 | |||
547 | static const struct i2c_device_id tvp5158_id[] = { | ||
548 | { "ti,tvp5158", 0 }, | ||
549 | { } | ||
550 | }; | ||
551 | MODULE_DEVICE_TABLE(i2c, tvp5158_id); | ||
552 | |||
553 | static const struct of_device_id tvp5158_dt_id[] = { | ||
554 | { | ||
555 | .compatible = "ti,tvp5158", .data = "tvp5158" | ||
556 | }, | ||
557 | { | ||
558 | } | ||
559 | }; | ||
560 | |||
561 | static int tvp5158_set_int_regs(struct i2c_client *client, | ||
562 | struct vbus_addr_value *reg, int cnt) | ||
563 | { | ||
564 | int i = 0; | ||
565 | /* Core Write enable*/ | ||
566 | tvp5158_write(client, REG_DEC_WR_EN, TVP_CORE_ALL); | ||
567 | for (i = 0; i < cnt; i++) { | ||
568 | tvp5158_write(client, REG_VBUS_1, ((reg[i].addr >> 0) & 0xFF)); | ||
569 | tvp5158_write(client, REG_VBUS_2, ((reg[i].addr >> 8) & 0xFF)); | ||
570 | tvp5158_write(client, REG_VBUS_3, ((reg[i].addr >> 16) & 0xFF)); | ||
571 | tvp5158_write(client, REG_VBUS_DATA, reg[i].val); | ||
572 | } | ||
573 | vbus_prog = 0; | ||
574 | return 0; | ||
575 | } | ||
576 | |||
577 | static int | ||
578 | tvp5158_set_default(struct i2c_client *client, unsigned char core) | ||
579 | { | ||
580 | unsigned char tvp_reg_val = 0; | ||
581 | /* Core Write enable*/ | ||
582 | tvp5158_write(client, REG_DEC_WR_EN, core); | ||
583 | /* Set Video format */ | ||
584 | tvp_reg_val = TVP_INTERLEAVE_MODE_LINE | TVP_CH_MUX_NUMBER | ||
585 | | TVP_OUTPUT_TYPE | TVP_VCS_ID | TVP_VID_RES; | ||
586 | tvp5158_write(client, REG_AVD_CTRL_1, tvp_reg_val); | ||
587 | tvp_reg_val = 0; | ||
588 | tvp_reg_val = TVP_ENABLE_DITHERING | TVP_VID_DET_SAVEAV_EN; | ||
589 | tvp5158_write(client, REG_AVD_CTRL_2, tvp_reg_val); | ||
590 | |||
591 | return 0; | ||
592 | } | ||
593 | |||
594 | static enum tvp5158_std | ||
595 | tvp5158_get_video_std(struct i2c_client *client, unsigned char core) | ||
596 | { | ||
597 | struct tvp5158_priv *priv = to_tvp5158(client); | ||
598 | int i2c_read = 0; | ||
599 | |||
600 | /* Core Read Enable */ | ||
601 | tvp5158_write(client, REG_DEC_RD_EN, core); | ||
602 | /* Get Video Status */ | ||
603 | i2c_read = tvp5158_read(client, REG_STAUS_2); | ||
604 | v4l2_dbg(1, debug, &priv->subdev, "%s\n", | ||
605 | (i2c_read & TVP_SIGNAL_PRESENT) ? | ||
606 | "Signal Present" : "Signal not present"); | ||
607 | |||
608 | if (!(i2c_read & TVP_SIGNAL_PRESENT)) { | ||
609 | priv->current_std = STD_INVALID; | ||
610 | goto fail; | ||
611 | } | ||
612 | |||
613 | i2c_read = tvp5158_read(client, REG_VID_STAND); | ||
614 | |||
615 | if ((i2c_read & TVP_VIDEO_STANDARD_MASK) == 0x1) { | ||
616 | |||
617 | priv->current_std = STD_NTSC_MJ; | ||
618 | v4l2_info(&priv->subdev, "NTSC video detected\n"); | ||
619 | } else if ((i2c_read & TVP_VIDEO_STANDARD_MASK) == 0x2) { | ||
620 | |||
621 | priv->current_std = STD_PAL_BDGHIN; | ||
622 | v4l2_info(&priv->subdev, "PAL video detected\n"); | ||
623 | } else { | ||
624 | v4l2_err(&priv->subdev, "No video detected\n"); | ||
625 | priv->current_std = STD_INVALID; | ||
626 | } | ||
627 | |||
628 | fail: | ||
629 | return priv->current_std; | ||
630 | } | ||
631 | |||
632 | static void | ||
633 | tvp5158_start_streaming(struct i2c_client *client, unsigned char core) | ||
634 | { | ||
635 | unsigned char tvp_reg_val = 0; | ||
636 | |||
637 | /* Decoder Write Enable */ | ||
638 | tvp5158_write(client, REG_DEC_WR_EN, core); | ||
639 | /* Enable output stream on */ | ||
640 | tvp_reg_val = TVP_VIDEO_PORT_ENABLE | TVP_OUT_CLK_P_EN; | ||
641 | tvp5158_write(client, REG_OFM_CTRL, tvp_reg_val); | ||
642 | |||
643 | } | ||
644 | |||
645 | static int tvp5158_probe(struct i2c_client *client, | ||
646 | const struct i2c_device_id *did) | ||
647 | { | ||
648 | struct tvp5158_priv *priv; | ||
649 | struct v4l2_subdev *sd; | ||
650 | struct device_node *node = client->dev.of_node; | ||
651 | int ret = -1; | ||
652 | int i2c_read; | ||
653 | union { | ||
654 | char buff[4]; | ||
655 | int buffer; | ||
656 | } u_i2cbuf; | ||
657 | |||
658 | priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL); | ||
659 | if (!priv) | ||
660 | return -ENOMEM; | ||
661 | i2c_set_clientdata(client, priv); | ||
662 | |||
663 | sd = &priv->subdev; | ||
664 | |||
665 | v4l2_i2c_subdev_init(sd, client, &tvp5158_subdev_ops); | ||
666 | |||
667 | ret = tvp5158_of_probe(client, node); | ||
668 | if (ret) { | ||
669 | dev_err(&client->dev, "Unable to of_probe\n"); | ||
670 | return ret; | ||
671 | } | ||
672 | |||
673 | ret = tvp5158_init_gpios(client); | ||
674 | if (ret) { | ||
675 | dev_err(&client->dev, "failed to init gpios ERR %d\n", ret); | ||
676 | return ret; | ||
677 | } | ||
678 | |||
679 | priv->current_std = STD_INVALID; | ||
680 | priv->format.code = tvp5158_cfmts[0].code; | ||
681 | priv->format.colorspace = tvp5158_cfmts[0].colorspace; | ||
682 | priv->format.field = V4L2_FIELD_ALTERNATE; | ||
683 | |||
684 | /* Get Chip ID and register with v4l2*/ | ||
685 | i2c_read = tvp5158_read(client, REG_CHIPID_MSB); | ||
686 | u_i2cbuf.buffer = i2c_read << 8; | ||
687 | i2c_read = tvp5158_read(client, REG_CHIPID_LSB); | ||
688 | u_i2cbuf.buffer |= i2c_read; | ||
689 | if (u_i2cbuf.buffer == 0x5158) { | ||
690 | v4l2_dbg(1, debug, sd, "Chip id : %x\n", u_i2cbuf.buffer); | ||
691 | tvp5158_write(client, REG_DEC_WR_EN, TVP_CORE_ALL); | ||
692 | tvp5158_write(client, REG_OFM_CTRL, | ||
693 | (TVP_VIDEO_PORT_ENABLE | TVP_OUT_CLK_P_EN)); | ||
694 | } else { | ||
695 | dev_err(&client->dev, "ERROR: Chip id is not TVP5158"); | ||
696 | return -ENODEV; | ||
697 | } | ||
698 | |||
699 | tvp5158_set_default(client, TVP_CORE_ALL); | ||
700 | tvp5158_get_video_std(client, TVP_CORE_ALL); | ||
701 | |||
702 | /* V4l2 asyn subdev register */ | ||
703 | sd->dev = &client->dev; | ||
704 | ret = v4l2_async_register_subdev(sd); | ||
705 | if (!ret) | ||
706 | v4l2_info(&priv->subdev, "Camera sensor driver registered\n"); | ||
707 | else | ||
708 | return ret; | ||
709 | |||
710 | pm_runtime_enable(&client->dev); | ||
711 | |||
712 | return ret; | ||
713 | } | ||
714 | |||
715 | static int tvp5158_remove(struct i2c_client *client) | ||
716 | { | ||
717 | struct tvp5158_priv *priv = i2c_get_clientdata(client); | ||
718 | |||
719 | v4l2_device_unregister_subdev(&priv->subdev); | ||
720 | return 0; | ||
721 | } | ||
722 | |||
723 | static struct i2c_driver tvp5158_i2c_driver = { | ||
724 | .driver = { | ||
725 | .owner = THIS_MODULE, | ||
726 | .name = "tvp5158", | ||
727 | .of_match_table = tvp5158_dt_id, | ||
728 | }, | ||
729 | .probe = tvp5158_probe, | ||
730 | .remove = tvp5158_remove, | ||
731 | .id_table = tvp5158_id, | ||
732 | }; | ||
733 | |||
734 | module_i2c_driver(tvp5158_i2c_driver); | ||
735 | |||
736 | MODULE_DESCRIPTION("Video Decoder driver"); | ||
737 | MODULE_AUTHOR("Sathishkumar S"); | ||
738 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 033b7dbf3d67..182a9089b996 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig | |||
@@ -303,6 +303,27 @@ config VIDEO_TI_VPE_DEBUG | |||
303 | 303 | ||
304 | endif # V4L_MEM2MEM_DRIVERS | 304 | endif # V4L_MEM2MEM_DRIVERS |
305 | 305 | ||
306 | config VIDEO_TI_VPDMA_HELPER | ||
307 | tristate "TI VPDMA helper module" | ||
308 | depends on VIDEO_TI_VIP || VIDEO_TI_VPE | ||
309 | default n | ||
310 | ---help--- | ||
311 | Video Port Direct Memory Access | ||
312 | Used with VIP and VPE on some TI SoC's (e.g. DRA7xx) | ||
313 | it provides a mem2mem, mem2device, device2mem DMA specifically | ||
314 | for transferring and manipulating video data. | ||
315 | |||
316 | config VIDEO_TI_VPDMA_LOAD_FW | ||
317 | bool "Load VPDMA F/W from Kernel" | ||
318 | depends on VIDEO_TI_VPDMA_HELPER | ||
319 | default n | ||
320 | ---help--- | ||
321 | TI SoC's Video Port Direct Memory Access module | ||
322 | needs a firmware to be loaded. This can be loaded from | ||
323 | user space via udev event or it can be loaded from kernel itself | ||
324 | Say 'y' if you want the Video devices to be initialized early | ||
325 | in the bootup sequence. | ||
326 | |||
306 | config VIDEO_TI_VPDMA | 327 | config VIDEO_TI_VPDMA |
307 | tristate | 328 | tristate |
308 | 329 | ||
diff --git a/drivers/media/platform/ti-vpe/vip.c b/drivers/media/platform/ti-vpe/vip.c index 9070e160d166..4fd828eaeee7 100644 --- a/drivers/media/platform/ti-vpe/vip.c +++ b/drivers/media/platform/ti-vpe/vip.c | |||
@@ -1592,6 +1592,15 @@ static int vip_try_fmt_vid_cap(struct file *file, void *priv, | |||
1592 | if (ret) | 1592 | if (ret) |
1593 | break; | 1593 | break; |
1594 | 1594 | ||
1595 | /* For interlaced capture, enum_frame size = FRAME size | ||
1596 | * while f->fmt.pix = FIELD size | ||
1597 | * Correct the subdev returned height params | ||
1598 | */ | ||
1599 | if (f->fmt.pix.field == V4L2_FIELD_ALTERNATE) { | ||
1600 | fse.min_height /= 2; | ||
1601 | fse.max_height /= 2; | ||
1602 | } | ||
1603 | |||
1595 | vip_dbg(3, dev, "try_fmt loop:%d fourcc:%s size: %dx%d\n", | 1604 | vip_dbg(3, dev, "try_fmt loop:%d fourcc:%s size: %dx%d\n", |
1596 | fse.index, fourcc_to_str(f->fmt.pix.pixelformat), | 1605 | fse.index, fourcc_to_str(f->fmt.pix.pixelformat), |
1597 | fse.max_width, fse.max_height); | 1606 | fse.max_width, fse.max_height); |
diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c index 9ac37fe1b6a7..b07ab05bc05a 100644 --- a/drivers/usb/dwc3/debugfs.c +++ b/drivers/usb/dwc3/debugfs.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/seq_file.h> | 25 | #include <linux/seq_file.h> |
26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
27 | #include <linux/uaccess.h> | 27 | #include <linux/uaccess.h> |
28 | #include <linux/extcon.h> | ||
28 | 29 | ||
29 | #include <linux/usb/ch9.h> | 30 | #include <linux/usb/ch9.h> |
30 | 31 | ||
@@ -357,6 +358,61 @@ static const struct debugfs_reg32 dwc3_regs[] = { | |||
357 | dump_register(OSTS), | 358 | dump_register(OSTS), |
358 | }; | 359 | }; |
359 | 360 | ||
361 | /* List of detectable cables */ | ||
362 | enum { | ||
363 | EXTCON_CABLE_USB = 0, | ||
364 | EXTCON_CABLE_USB_HOST, | ||
365 | EXTCON_CABLE_END, | ||
366 | }; | ||
367 | |||
368 | static void usb_extcon_simulate_cable(struct dwc3 *dwc, enum usb_dr_mode mode) | ||
369 | { | ||
370 | const char *usb_extcon_cable[] = { | ||
371 | [EXTCON_CABLE_USB] = "USB", | ||
372 | [EXTCON_CABLE_USB_HOST] = "USB-HOST", | ||
373 | NULL, | ||
374 | }; | ||
375 | bool id, vbus; | ||
376 | |||
377 | if (!dwc->edev) | ||
378 | return; | ||
379 | |||
380 | /* set ID and VBUS based on usb-mode and update cable state */ | ||
381 | switch (mode) { | ||
382 | case USB_DR_MODE_HOST: | ||
383 | id = false; | ||
384 | vbus = false; | ||
385 | break; | ||
386 | case USB_DR_MODE_PERIPHERAL: | ||
387 | id = true; | ||
388 | vbus = true; | ||
389 | break; | ||
390 | case USB_DR_MODE_OTG: | ||
391 | id = false; | ||
392 | vbus = true; | ||
393 | break; | ||
394 | default: | ||
395 | return; | ||
396 | } | ||
397 | |||
398 | /* at first we clean states which are no longer active */ | ||
399 | if (id) | ||
400 | extcon_set_cable_state(dwc->edev, | ||
401 | usb_extcon_cable[EXTCON_CABLE_USB_HOST], false); | ||
402 | |||
403 | if (!vbus) | ||
404 | extcon_set_cable_state(dwc->edev, | ||
405 | usb_extcon_cable[EXTCON_CABLE_USB], false); | ||
406 | |||
407 | if (!id) | ||
408 | extcon_set_cable_state(dwc->edev, | ||
409 | usb_extcon_cable[EXTCON_CABLE_USB_HOST], true); | ||
410 | |||
411 | if (vbus) | ||
412 | extcon_set_cable_state(dwc->edev, | ||
413 | usb_extcon_cable[EXTCON_CABLE_USB], true); | ||
414 | } | ||
415 | |||
360 | static int dwc3_mode_show(struct seq_file *s, void *unused) | 416 | static int dwc3_mode_show(struct seq_file *s, void *unused) |
361 | { | 417 | { |
362 | struct dwc3 *dwc = s->private; | 418 | struct dwc3 *dwc = s->private; |
@@ -410,11 +466,22 @@ static ssize_t dwc3_mode_write(struct file *file, | |||
410 | if (!strncmp(buf, "otg", 3)) | 466 | if (!strncmp(buf, "otg", 3)) |
411 | mode |= DWC3_GCTL_PRTCAP_OTG; | 467 | mode |= DWC3_GCTL_PRTCAP_OTG; |
412 | 468 | ||
469 | if (dwc->dr_mode == USB_DR_MODE_OTG) { | ||
470 | if (mode & DWC3_GCTL_PRTCAP_HOST) | ||
471 | usb_extcon_simulate_cable(dwc, USB_DR_MODE_HOST); | ||
472 | else if (mode & DWC3_GCTL_PRTCAP_DEVICE) | ||
473 | usb_extcon_simulate_cable(dwc, USB_DR_MODE_PERIPHERAL); | ||
474 | else if (mode & DWC3_GCTL_PRTCAP_OTG) | ||
475 | usb_extcon_simulate_cable(dwc, USB_DR_MODE_OTG); | ||
476 | return count; | ||
477 | } | ||
478 | |||
413 | if (mode) { | 479 | if (mode) { |
414 | spin_lock_irqsave(&dwc->lock, flags); | 480 | spin_lock_irqsave(&dwc->lock, flags); |
415 | dwc3_set_mode(dwc, mode); | 481 | dwc3_set_mode(dwc, mode); |
416 | spin_unlock_irqrestore(&dwc->lock, flags); | 482 | spin_unlock_irqrestore(&dwc->lock, flags); |
417 | } | 483 | } |
484 | |||
418 | return count; | 485 | return count; |
419 | } | 486 | } |
420 | 487 | ||
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index e0606c01e8ac..2ad79397ff8b 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -30,6 +30,8 @@ endmenu | |||
30 | 30 | ||
31 | source "drivers/video/backlight/Kconfig" | 31 | source "drivers/video/backlight/Kconfig" |
32 | 32 | ||
33 | source "drivers/video/serdes/Kconfig" | ||
34 | |||
33 | config VGASTATE | 35 | config VGASTATE |
34 | tristate | 36 | tristate |
35 | default n | 37 | default n |
diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 9ad3c17d6456..21ba658ccd1c 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile | |||
@@ -6,6 +6,7 @@ obj-$(CONFIG_LOGO) += logo/ | |||
6 | obj-y += backlight/ | 6 | obj-y += backlight/ |
7 | 7 | ||
8 | obj-y += fbdev/ | 8 | obj-y += fbdev/ |
9 | obj-y += serdes/ | ||
9 | 10 | ||
10 | obj-$(CONFIG_VIDEOMODE_HELPERS) += display_timing.o videomode.o | 11 | obj-$(CONFIG_VIDEOMODE_HELPERS) += display_timing.o videomode.o |
11 | ifeq ($(CONFIG_OF),y) | 12 | ifeq ($(CONFIG_OF),y) |
diff --git a/drivers/video/serdes/Kconfig b/drivers/video/serdes/Kconfig new file mode 100644 index 000000000000..84efb53bdab3 --- /dev/null +++ b/drivers/video/serdes/Kconfig | |||
@@ -0,0 +1,12 @@ | |||
1 | menu "Video Serializer Deserializer drivers" | ||
2 | |||
3 | config VIDEO_TI_FPD3_SERDES | ||
4 | tristate "Texas Instruments FPD link 3 serializer deserializer" | ||
5 | depends on I2C | ||
6 | help | ||
7 | This driver is used for configuring video serializers and | ||
8 | deserializers. When capturing video from a remote camera or | ||
9 | displaying to a remote display, the camera or display is | ||
10 | connected via FPDlink serializer / deserializer. | ||
11 | |||
12 | endmenu | ||
diff --git a/drivers/video/serdes/Makefile b/drivers/video/serdes/Makefile new file mode 100644 index 000000000000..eab69490ed5a --- /dev/null +++ b/drivers/video/serdes/Makefile | |||
@@ -0,0 +1,2 @@ | |||
1 | obj-$(CONFIG_VIDEO_TI_FPD3_SERDES) += ti-fpd3-serdes.o | ||
2 | ti-fpd3-serdes-y := fpd3_serdes.o fpd3_i2c_adap.o | ||
diff --git a/drivers/video/serdes/fpd3_i2c_adap.c b/drivers/video/serdes/fpd3_i2c_adap.c new file mode 100644 index 000000000000..d43de5a43c06 --- /dev/null +++ b/drivers/video/serdes/fpd3_i2c_adap.c | |||
@@ -0,0 +1,319 @@ | |||
1 | /* | ||
2 | * fpd3_i2c_adap.c | ||
3 | * | ||
4 | * lvds based serial link interface for onboard communication. | ||
5 | * Copyright (C) 2014-2015 Texas Instruments Incorporated - http://www.ti.com/ | ||
6 | * Authors: Nikhil Devshatwar <nikhil.nd@ti.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License version 2 as published by | ||
10 | * the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
15 | * more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License along with | ||
18 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | ||
20 | |||
21 | /* | ||
22 | * This file has helper functions to implement an i2c bus adapter driver for | ||
23 | * fpd3_serdes devices. Only the master device can communicate with the | ||
24 | * serializer and any other slaves connected at the remote end. | ||
25 | * | ||
26 | * Every i2c slave at the remote bus, can be accessed from linux i2c | ||
27 | * using aliases. Master device registers some aliases and maps them to the | ||
28 | * actual device addresses at remote bus. | ||
29 | * | ||
30 | * Any transactions addressed for these alias are detected by the master device | ||
31 | * and then recreated at the remote i2c bus with the real slave address. | ||
32 | * So in a way, master device acts as an i2c adapter driver for all the | ||
33 | * remote clients. | ||
34 | * | ||
35 | * This file implements an i2c adapter which just reroutes the transactions | ||
36 | * on the parent adapter with alias for the slave. | ||
37 | */ | ||
38 | |||
39 | #include <linux/kernel.h> | ||
40 | #include <linux/slab.h> | ||
41 | #include <linux/i2c.h> | ||
42 | #include <linux/delay.h> | ||
43 | #include "fpd3_serdes.h" | ||
44 | |||
45 | static int fpd3_serdes_setup_aliases(struct i2c_client *client) | ||
46 | { | ||
47 | struct fpd3_serdes_data *data = i2c_get_clientdata(client); | ||
48 | const struct fpd3_serdes_platform_data *pdata = data->pdata; | ||
49 | int i = 0, ret, count = 0; | ||
50 | u8 reg; | ||
51 | |||
52 | /* | ||
53 | * First entry is for the remote serdes and any further entries | ||
54 | * are for the slaves connected at remote bus | ||
55 | */ | ||
56 | for (i = 0; i < data->num_slaves; i++) { | ||
57 | |||
58 | if (data->slave_addr[i] == 0) | ||
59 | continue; | ||
60 | /* Setup the real slave address */ | ||
61 | if (i == 0) | ||
62 | reg = pdata->dev_type == FPD3_SER_DEV ? | ||
63 | FPD3_SER_DES_ID : FPD3_DES_SER_ID; | ||
64 | else { | ||
65 | reg = pdata->dev_type == FPD3_SER_DEV ? | ||
66 | FPD3_SER_SLAVE_ID0 : FPD3_DES_SLAVE_ID0; | ||
67 | reg += i - 1; | ||
68 | } | ||
69 | ret = i2c_write_le8(client, reg, data->slave_addr[i] << 1); | ||
70 | if (ret < 0) | ||
71 | goto error_setup; | ||
72 | |||
73 | /* Setup the alias for the slave */ | ||
74 | if (i == 0) | ||
75 | reg = pdata->dev_type == FPD3_SER_DEV ? | ||
76 | FPD3_SER_DES_AL : FPD3_DES_SER_AL; | ||
77 | else { | ||
78 | reg = pdata->dev_type == FPD3_SER_DEV ? | ||
79 | FPD3_SER_SLAVE_AL0 : FPD3_DES_SLAVE_AL0; | ||
80 | reg += + i - 1; | ||
81 | } | ||
82 | ret = i2c_write_le8(client, reg, data->slave_alias[i] << 1); | ||
83 | if (ret < 0) | ||
84 | goto error_setup; | ||
85 | |||
86 | dev_dbg(&client->dev, "Registered alias 0x%2x for 0x%02x", | ||
87 | data->slave_alias[i], data->slave_addr[i]); | ||
88 | } | ||
89 | |||
90 | while (count < FPD3_MAX_POLL_COUNT) { | ||
91 | |||
92 | reg = pdata->dev_type == FPD3_SER_DEV ? | ||
93 | FPD3_SER_GN_STS : FPD3_DES_GN_STS; | ||
94 | ret = i2c_read_le8(client, reg); | ||
95 | if (ret < 0) | ||
96 | return ret; | ||
97 | if (ret & SIGNAL_DETECT) | ||
98 | break; | ||
99 | udelay(10); | ||
100 | count++; | ||
101 | } | ||
102 | |||
103 | if (count >= FPD3_MAX_POLL_COUNT) | ||
104 | return -EIO; | ||
105 | |||
106 | dev_dbg(&client->dev, "Remote signal detected"); | ||
107 | return 0; | ||
108 | error_setup: | ||
109 | dev_err(&client->dev, "Failed to setup alias for %2x", | ||
110 | data->slave_addr[i]); | ||
111 | return ret; | ||
112 | } | ||
113 | |||
114 | static int setup_link(struct i2c_adapter *adap) | ||
115 | { | ||
116 | struct i2c_client *client = i2c_get_adapdata(adap); | ||
117 | struct fpd3_serdes_data *data = i2c_get_clientdata(client); | ||
118 | int ret; | ||
119 | |||
120 | if (data->link_ok) | ||
121 | return 0; | ||
122 | else if (data->link_ok < 0) | ||
123 | return data->link_ok; | ||
124 | |||
125 | ret = fpd3_serdes_initialize(client); | ||
126 | if (ret == 0) | ||
127 | ret = fpd3_serdes_setup_aliases(client); | ||
128 | if (ret == 0) | ||
129 | data->link_ok = 1; | ||
130 | else | ||
131 | data->link_ok = -EIO; | ||
132 | return ret; | ||
133 | } | ||
134 | |||
135 | static u8 fpd3_alloc_addr(struct i2c_adapter *adap, u8 addr) | ||
136 | { | ||
137 | struct i2c_client *client = i2c_get_adapdata(adap); | ||
138 | struct fpd3_serdes_data *data = i2c_get_clientdata(client); | ||
139 | const struct fpd3_serdes_platform_data *pdata = data->pdata; | ||
140 | u8 reg, i; | ||
141 | |||
142 | for (i = 0; i < data->num_slaves; i++) { | ||
143 | if (data->slave_addr[i] == 0x0) | ||
144 | break; | ||
145 | } | ||
146 | if (i < data->num_slaves) { | ||
147 | |||
148 | /* Program new mapping for remote address and alias */ | ||
149 | reg = pdata->dev_type == FPD3_SER_DEV ? | ||
150 | FPD3_SER_SLAVE_ID0 : FPD3_DES_SLAVE_ID0; | ||
151 | i2c_write_le8(client, reg, addr << 1); | ||
152 | |||
153 | reg = pdata->dev_type == FPD3_SER_DEV ? | ||
154 | FPD3_SER_SLAVE_AL0 : FPD3_DES_SLAVE_AL0; | ||
155 | i2c_write_le8(client, reg, data->slave_alias[i] << 1); | ||
156 | |||
157 | return data->slave_alias[i]; | ||
158 | } else | ||
159 | return 0; | ||
160 | } | ||
161 | |||
162 | static u8 __get_alias_addr(struct i2c_adapter *adap, u8 addr) | ||
163 | { | ||
164 | struct i2c_client *client = i2c_get_adapdata(adap); | ||
165 | struct fpd3_serdes_data *data = i2c_get_clientdata(client); | ||
166 | u8 new_alias; | ||
167 | int i; | ||
168 | |||
169 | /* master device should have the mapping between the | ||
170 | * slave address on remote bus to alias for which master device | ||
171 | * is monitoring for transactions */ | ||
172 | for (i = 0; i < data->num_slaves; i++) { | ||
173 | if (data->slave_addr[i] == addr) | ||
174 | break; | ||
175 | } | ||
176 | |||
177 | if (data->slave_addr[i] == addr) | ||
178 | return data->slave_alias[i]; | ||
179 | |||
180 | new_alias = fpd3_alloc_addr(adap, addr); | ||
181 | if (new_alias == 0) | ||
182 | dev_err(&adap->dev, "Cannot translate chip addr 0x%02x", addr); | ||
183 | |||
184 | return new_alias; | ||
185 | } | ||
186 | |||
187 | static struct i2c_adapter *__get_alias_adapter(struct i2c_adapter *adap) | ||
188 | { | ||
189 | struct i2c_client *client = i2c_get_adapdata(adap); | ||
190 | |||
191 | /* Same i2c adapter used for the master device should be | ||
192 | * used for communicating with the remote device via alias */ | ||
193 | return client->adapter; | ||
194 | } | ||
195 | |||
196 | static int fpd3_master_xfer(struct i2c_adapter *adap, | ||
197 | struct i2c_msg msgs[], int num) | ||
198 | { | ||
199 | struct i2c_adapter *alias_adap; | ||
200 | struct i2c_msg new_msg; | ||
201 | u8 alias_addr; | ||
202 | int i, ret = 0; | ||
203 | |||
204 | if (setup_link(adap)) | ||
205 | return -EIO; | ||
206 | |||
207 | alias_adap = __get_alias_adapter(adap); | ||
208 | |||
209 | for (i = 0; i < num; i++) { | ||
210 | alias_addr = __get_alias_addr(adap, msgs[i].addr); | ||
211 | if (alias_addr == 0) { | ||
212 | ret = -EINVAL; | ||
213 | break; | ||
214 | } | ||
215 | |||
216 | /* Copy the i2c_msgs into temporary buffer; xlate address */ | ||
217 | new_msg = msgs[i]; | ||
218 | new_msg.addr = alias_addr; | ||
219 | /* Issue the messages on the alias adapter */ | ||
220 | ret = i2c_transfer(alias_adap, &new_msg, 1); | ||
221 | if (ret) | ||
222 | break; | ||
223 | } | ||
224 | |||
225 | return ret; | ||
226 | } | ||
227 | |||
228 | static int fpd3_smbus_xfer(struct i2c_adapter *adap, u16 addr, | ||
229 | unsigned short flags, char read_write, | ||
230 | u8 command, int size, union i2c_smbus_data *data) | ||
231 | { | ||
232 | struct i2c_adapter *alias_adap; | ||
233 | u8 alias_addr; | ||
234 | |||
235 | if (setup_link(adap)) | ||
236 | return -EIO; | ||
237 | |||
238 | alias_adap = __get_alias_adapter(adap); | ||
239 | alias_addr = __get_alias_addr(adap, addr); | ||
240 | if (alias_addr == 0) | ||
241 | return -EINVAL; | ||
242 | |||
243 | return i2c_smbus_xfer(alias_adap, alias_addr, flags, read_write, | ||
244 | command, size, data); | ||
245 | } | ||
246 | |||
247 | static u32 fpd3_i2c_func(struct i2c_adapter *adap) | ||
248 | { | ||
249 | return I2C_FUNC_I2C | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK) | | ||
250 | I2C_FUNC_PROTOCOL_MANGLING; | ||
251 | } | ||
252 | |||
253 | static const struct i2c_algorithm fpd3_i2c_algo = { | ||
254 | .master_xfer = fpd3_master_xfer, | ||
255 | .smbus_xfer = fpd3_smbus_xfer, | ||
256 | .functionality = fpd3_i2c_func, | ||
257 | }; | ||
258 | |||
259 | static int parse_address_translation(struct i2c_client *client) | ||
260 | { | ||
261 | struct device_node *node = client->dev.of_node; | ||
262 | struct fpd3_serdes_data *data = i2c_get_clientdata(client); | ||
263 | const struct fpd3_serdes_platform_data *pdata = data->pdata; | ||
264 | unsigned int slave_bus_addr, master_bus_addr; | ||
265 | int ret, i; | ||
266 | |||
267 | for (i = 0; i < pdata->nslaves + 1; i++) { | ||
268 | |||
269 | ret = of_property_read_u32_index(node, "ranges", 2 * i, | ||
270 | &slave_bus_addr); | ||
271 | if (ret) | ||
272 | break; | ||
273 | ret = of_property_read_u32_index(node, "ranges", 2 * i + 1, | ||
274 | &master_bus_addr); | ||
275 | if (ret) | ||
276 | break; | ||
277 | |||
278 | data->slave_addr[i] = slave_bus_addr; | ||
279 | data->slave_alias[i] = master_bus_addr; | ||
280 | } | ||
281 | data->num_slaves = i; | ||
282 | ret = 0; | ||
283 | |||
284 | if (i == 0) { | ||
285 | dev_err(&client->dev, "Master mode device does not have slave address translation information"); | ||
286 | return -ENODEV; | ||
287 | } | ||
288 | return 0; | ||
289 | } | ||
290 | |||
291 | int fpd3_register_i2c_adapter(struct i2c_client *client) | ||
292 | { | ||
293 | struct fpd3_serdes_data *data = i2c_get_clientdata(client); | ||
294 | struct i2c_adapter *adap; | ||
295 | int ret = 0; | ||
296 | |||
297 | dev_dbg(&client->dev, "Registering i2c adapter"); | ||
298 | |||
299 | adap = kzalloc(sizeof(*adap), GFP_KERNEL); | ||
300 | if (adap == NULL) | ||
301 | return -ENOMEM; | ||
302 | |||
303 | data->adap = adap; | ||
304 | adap->nr = -1; | ||
305 | adap->owner = THIS_MODULE; | ||
306 | adap->class = I2C_CLASS_HWMON; | ||
307 | adap->algo = &fpd3_i2c_algo; | ||
308 | adap->dev.parent = &client->dev; | ||
309 | adap->dev.of_node = client->dev.of_node; | ||
310 | strlcpy(adap->name, "LVDS I2C adapter", sizeof(adap->name)); | ||
311 | |||
312 | ret = parse_address_translation(client); | ||
313 | if (ret) | ||
314 | return ret; | ||
315 | |||
316 | i2c_set_adapdata(adap, client); | ||
317 | return i2c_add_numbered_adapter(adap); | ||
318 | } | ||
319 | |||
diff --git a/drivers/video/serdes/fpd3_serdes.c b/drivers/video/serdes/fpd3_serdes.c new file mode 100644 index 000000000000..90de8d559f2f --- /dev/null +++ b/drivers/video/serdes/fpd3_serdes.c | |||
@@ -0,0 +1,416 @@ | |||
1 | /* | ||
2 | * fpd3_serdes.c | ||
3 | * | ||
4 | * lvds based serial link interface for onboard communication. | ||
5 | * Copyright (C) 2014-2015 Texas Instruments Incorporated - http://www.ti.com/ | ||
6 | * Authors: Nikhil Devshatwar <nikhil.nd@ti.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License version 2 as published by | ||
10 | * the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
15 | * more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License along with | ||
18 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | ||
20 | |||
21 | /* | ||
22 | * Datasheets:- | ||
23 | * DS90UB913aq/DS90UB914aq http://www.ti.com/lit/ds/snls443a/snls443a.pdf | ||
24 | * DS90UH925Q http://www.ti.com/lit/ds/symlink/ds90uh925q-q1.pdf | ||
25 | * DS90UH928Q http://www.ti.com/lit/ds/snls440a/snls440a.pdf | ||
26 | * | ||
27 | * Documentation:- | ||
28 | * -> Documentation/video-serdes.txt | ||
29 | * -> Documentation/devicetree/bindings/video/fpd3-serdes.txt | ||
30 | */ | ||
31 | |||
32 | #include <linux/kernel.h> | ||
33 | #include <linux/module.h> | ||
34 | #include <linux/slab.h> | ||
35 | #include <linux/i2c.h> | ||
36 | #include <linux/gpio.h> | ||
37 | #include <linux/delay.h> | ||
38 | #include <linux/of_gpio.h> | ||
39 | #include <linux/of_device.h> | ||
40 | #include "fpd3_serdes.h" | ||
41 | |||
42 | static const unsigned int fpd3_12bit_ser_init[] = { | ||
43 | /* auto volt ctrl en, 3.3V, digital reset0, digital reset1 */ | ||
44 | FPD3_SER_RESET, 0x33, | ||
45 | /* RX CRC check, TX parity en, i2c passthrough, rising edge pclk */ | ||
46 | FPD3_SER_CONFIG1, 0xc5, | ||
47 | /* GPIO0 - o/p LOW, GPIO0 - o/p HIGH */ | ||
48 | FPD3_SER_GPIO_01, 0x55, | ||
49 | }; | ||
50 | |||
51 | static const unsigned int fpd3_12bit_des_init[] = { | ||
52 | /* back channel en */ | ||
53 | FPD3_DES_RESET, 0x04, | ||
54 | /* RX parity check, TX CRC check, auto volt ctrl en | ||
55 | * i2c passthrough, auto ack WR, rising edge pclk */ | ||
56 | FPD3_DES_CONFIG1, 0xec, | ||
57 | }; | ||
58 | |||
59 | static const unsigned int fpd3_24bit_ser_init[] = { | ||
60 | /* digital reset1 */ | ||
61 | FPD3_SER_RESET, 0x02, | ||
62 | /* back chan en, auto ack WR, i2c passthrough, rising edge pclk */ | ||
63 | FPD3_SER_CONFIG1, 0xab, | ||
64 | /* failsafe low, LFMODE override, high freq*/ | ||
65 | FPD3_SER_CONFIG2, 0x8a, | ||
66 | /* RGB data, 24bit, i2s data forwarding */ | ||
67 | FPD3_SER_DATA_CTRL, 0x8a, | ||
68 | }; | ||
69 | |||
70 | static const unsigned int fpd3_24bit_des_init[] = { | ||
71 | /* digital reset1 */ | ||
72 | FPD3_DES_RESET, 0x02, | ||
73 | /* back channel en */ | ||
74 | FPD3_DES_RESET, 0x04, | ||
75 | /* auto clk en, LFMODE override, high freq */ | ||
76 | FPD3_DES_CONFIG0, 0x2a, | ||
77 | /* failsafe pull up, i2c passthrough, auto ack */ | ||
78 | FPD3_DES_CONFIG1, 0x4c, | ||
79 | }; | ||
80 | |||
81 | static struct fpd3_serdes_platform_data fpd3_serdes_pdata[] = { | ||
82 | { | ||
83 | .name = "fpd3_12b_ser", | ||
84 | .dev_type = FPD3_SER_DEV, | ||
85 | .ngpio = 4, | ||
86 | .nslaves = 1, | ||
87 | .device_id = 0xb0, | ||
88 | .gpio_2reg = 2 * FPD3_SER_GPIO_01, | ||
89 | .init_seq = fpd3_12bit_ser_init, | ||
90 | .init_len = ARRAY_SIZE(fpd3_12bit_ser_init), | ||
91 | }, | ||
92 | { | ||
93 | .name = "fpd3_12b_des", | ||
94 | .dev_type = FPD3_DES_DEV, | ||
95 | .ngpio = 4, | ||
96 | .nslaves = 8, | ||
97 | .device_id = 0xc0, | ||
98 | .gpio_2reg = 2 * FPD3_DES_GPIO_01, | ||
99 | .init_seq = fpd3_12bit_des_init, | ||
100 | .init_len = ARRAY_SIZE(fpd3_12bit_des_init), | ||
101 | }, | ||
102 | { | ||
103 | .name = "fpd3_24b_ser", | ||
104 | .dev_type = FPD3_SER_DEV, | ||
105 | .ngpio = 4, | ||
106 | .nslaves = 1, | ||
107 | .device_id = 0x36, | ||
108 | .gpio_2reg = 2 * FPD3_SER_GPIO_01 + 1, | ||
109 | .init_seq = fpd3_24bit_ser_init, | ||
110 | .init_len = ARRAY_SIZE(fpd3_24bit_ser_init), | ||
111 | }, | ||
112 | { | ||
113 | .name = "fpd3_24b_des", | ||
114 | .dev_type = FPD3_DES_DEV, | ||
115 | .ngpio = 4, | ||
116 | .nslaves = 8, | ||
117 | .device_id = 0x58, | ||
118 | .gpio_2reg = 2 * FPD3_DES_GPIO_01 + 1, | ||
119 | .init_seq = fpd3_24bit_des_init, | ||
120 | .init_len = ARRAY_SIZE(fpd3_24bit_des_init), | ||
121 | }, | ||
122 | }; | ||
123 | |||
124 | /* GPIO operations */ | ||
125 | static int __fpd3_serdes_dirval(struct gpio_chip *chip, | ||
126 | unsigned offset, int value, int shift) | ||
127 | { | ||
128 | struct fpd3_serdes_data *data = | ||
129 | container_of(chip, struct fpd3_serdes_data, chip); | ||
130 | const struct fpd3_serdes_platform_data *pdata = data->pdata; | ||
131 | struct i2c_client *client = data->client; | ||
132 | int reg, val = 0x00; | ||
133 | |||
134 | reg = (pdata->gpio_2reg + offset) / 2; | ||
135 | if ((pdata->gpio_2reg + offset) % 2) | ||
136 | shift += 4; | ||
137 | |||
138 | val = i2c_read_le8(client, reg); | ||
139 | |||
140 | if (value) | ||
141 | val |= 1 << shift; | ||
142 | else | ||
143 | val &= ~(1 << shift); | ||
144 | |||
145 | return i2c_write_le8(client, reg, val); | ||
146 | } | ||
147 | |||
148 | static int fpd3_serdes_input(struct gpio_chip *chip, unsigned offset) | ||
149 | { | ||
150 | return __fpd3_serdes_dirval(chip, offset, | ||
151 | GPIO_DIR_INPUT, GPIO_SHIFT_DIR); | ||
152 | } | ||
153 | static int fpd3_serdes_output(struct gpio_chip *chip, | ||
154 | unsigned offset, int value) | ||
155 | { | ||
156 | int ret; | ||
157 | |||
158 | ret = __fpd3_serdes_dirval(chip, offset, | ||
159 | GPIO_DIR_OUTPUT, GPIO_SHIFT_DIR); | ||
160 | |||
161 | if (ret) | ||
162 | ret = __fpd3_serdes_dirval(chip, offset, | ||
163 | value, GPIO_SHIFT_VAL); | ||
164 | |||
165 | return ret; | ||
166 | } | ||
167 | |||
168 | static void fpd3_serdes_set(struct gpio_chip *chip, unsigned offset, int value) | ||
169 | { | ||
170 | __fpd3_serdes_dirval(chip, offset, value, GPIO_SHIFT_VAL); | ||
171 | } | ||
172 | |||
173 | static int fpd3_serdes_get(struct gpio_chip *chip, unsigned offset) | ||
174 | { | ||
175 | struct fpd3_serdes_data *data = | ||
176 | container_of(chip, struct fpd3_serdes_data, chip); | ||
177 | const struct fpd3_serdes_platform_data *pdata = data->pdata; | ||
178 | struct i2c_client *client = data->client; | ||
179 | int reg; | ||
180 | |||
181 | int shift = GPIO_SHIFT_VAL; | ||
182 | reg = (pdata->gpio_2reg + offset) / 2; | ||
183 | if ((pdata->gpio_2reg + offset) % 2) | ||
184 | shift += 4; | ||
185 | |||
186 | return (i2c_read_le8(client, reg) | 1 << shift) ? 1 : 0; | ||
187 | } | ||
188 | |||
189 | static struct gpio_chip fpd3_serdes_gpiochip = { | ||
190 | .owner = THIS_MODULE, | ||
191 | .base = -1, | ||
192 | .ngpio = 4, | ||
193 | .can_sleep = false, | ||
194 | |||
195 | .get = fpd3_serdes_get, | ||
196 | .set = fpd3_serdes_set, | ||
197 | .direction_input = fpd3_serdes_input, | ||
198 | .direction_output = fpd3_serdes_output, | ||
199 | }; | ||
200 | |||
201 | int fpd3_serdes_initialize(struct i2c_client *client) | ||
202 | { | ||
203 | struct fpd3_serdes_data *data = i2c_get_clientdata(client); | ||
204 | const struct fpd3_serdes_platform_data *pdata = data->pdata; | ||
205 | const unsigned int *seq; | ||
206 | int i, len, reg, ret = 0, count = 0; | ||
207 | |||
208 | if (data->slave_mode == false) { | ||
209 | /* Wait for the device to initialize and show up device ID */ | ||
210 | reg = pdata->dev_type == FPD3_SER_DEV ? | ||
211 | FPD3_SER_DEV_ID : FPD3_SER_DEV_ID; | ||
212 | while (ret != pdata->device_id && count < FPD3_MAX_POLL_COUNT) { | ||
213 | ret = i2c_read_le8(client, reg); | ||
214 | count++; | ||
215 | mdelay(3); | ||
216 | } | ||
217 | if (count == FPD3_MAX_POLL_COUNT) { | ||
218 | dev_err(&client->dev, "Not a %s chip", pdata->name); | ||
219 | return -ENODEV; | ||
220 | } | ||
221 | } | ||
222 | |||
223 | len = pdata->init_len; | ||
224 | seq = pdata->init_seq; | ||
225 | for (i = 0; i < len; i += 2) { | ||
226 | ret = i2c_write_le8(client, seq[i], seq[i+1]); | ||
227 | if (ret) | ||
228 | break; | ||
229 | if (seq[i] == 0x01) | ||
230 | udelay(500); | ||
231 | else | ||
232 | udelay(10); | ||
233 | } | ||
234 | |||
235 | return ret; | ||
236 | } | ||
237 | EXPORT_SYMBOL(fpd3_serdes_initialize); | ||
238 | |||
239 | /* On Vision app board (up to Rev B), the deserializer I2C addresses | ||
240 | * conflicts with the HDMI receiver chip, making deserializer unaccessible. | ||
241 | * The workaround is to change the I2C address of the HDMI receiver at runtime. | ||
242 | * Following code removes the conflict between HDMI SIL9127 and deserializers | ||
243 | * 0x31 is default I2C address of SIL9127 | ||
244 | */ | ||
245 | static int fpd3_serdes_remove_conflict(struct i2c_client *client) | ||
246 | { | ||
247 | struct regval { | ||
248 | u8 reg; | ||
249 | u8 val; | ||
250 | } conflict_regval[] = { | ||
251 | { 0x14, 0xf4, }, | ||
252 | { 0x15, 0xf6, }, | ||
253 | { 0x16, 0xf8, }, | ||
254 | { 0x17, 0xfa, }, | ||
255 | { 0x18, 0xfc, }, | ||
256 | { 0x19, 0xfe, }, | ||
257 | }; | ||
258 | union i2c_smbus_data data; | ||
259 | int i, ret; | ||
260 | u16 addr = 0x31; | ||
261 | static bool conflict_exist = true; | ||
262 | |||
263 | if (!conflict_exist) | ||
264 | return 0; | ||
265 | |||
266 | conflict_exist = false; | ||
267 | for (i = 0; i < 6; i++) { | ||
268 | data.byte = conflict_regval[i].val; | ||
269 | ret = i2c_smbus_xfer(client->adapter, addr, client->flags, | ||
270 | I2C_SMBUS_WRITE, conflict_regval[i].reg, | ||
271 | I2C_SMBUS_BYTE_DATA, &data); | ||
272 | if (ret) | ||
273 | return ret; | ||
274 | } | ||
275 | |||
276 | dev_err(&client->dev, "Removed conflict b/w HDMI SIL"); | ||
277 | return 0; | ||
278 | } | ||
279 | |||
280 | static int fpd3_serdes_of_probe(struct i2c_client *client, | ||
281 | struct device_node *node) | ||
282 | { | ||
283 | struct fpd3_serdes_data *data = i2c_get_clientdata(client); | ||
284 | int gpio, ret; | ||
285 | |||
286 | gpio = of_get_gpio(node, 0); | ||
287 | if (gpio_is_valid(gpio)) { | ||
288 | /* Toggle the pdb bit from LOW to HIGH */ | ||
289 | ret = devm_gpio_request_one(&client->dev, gpio, | ||
290 | GPIOF_INIT_HIGH, "des_pdb"); | ||
291 | } else if (gpio == -ENOENT) | ||
292 | /* Entry not present - no need to toggle pdb */ | ||
293 | ret = 0; | ||
294 | else | ||
295 | ret = gpio; | ||
296 | |||
297 | if (ret) | ||
298 | return ret; | ||
299 | |||
300 | data->gpio_export = of_find_property(node, "gpio-controller", NULL) ? | ||
301 | true : false; | ||
302 | data->slave_mode = of_find_property(node, "slave-mode", NULL) ? | ||
303 | true : false; | ||
304 | return 0; | ||
305 | } | ||
306 | |||
307 | static const struct i2c_device_id fpd3_serdes_i2c_ids[] = { | ||
308 | { "ds90ub913aq", 8 }, | ||
309 | { "ds90ub914aq", 8 }, | ||
310 | { "ds90uh925q", 8 }, | ||
311 | { "ds90uh928q", 8 }, | ||
312 | { } | ||
313 | }; | ||
314 | MODULE_DEVICE_TABLE(i2c, fpd3_serdes_i2c_ids); | ||
315 | |||
316 | static const struct of_device_id fpd3_serdes_dt_ids[] = { | ||
317 | {.compatible = "ti,ds90ub913aq", &fpd3_serdes_pdata[0], }, | ||
318 | {.compatible = "ti,ds90ub914aq", &fpd3_serdes_pdata[1], }, | ||
319 | {.compatible = "ti,ds90uh925q", &fpd3_serdes_pdata[2], }, | ||
320 | {.compatible = "ti,ds90uh928q", &fpd3_serdes_pdata[3], }, | ||
321 | { } | ||
322 | }; | ||
323 | |||
324 | MODULE_DEVICE_TABLE(of, fpd3_serdes_dt_ids); | ||
325 | |||
326 | static int fpd3_serdes_probe(struct i2c_client *client, | ||
327 | const struct i2c_device_id *id) | ||
328 | { | ||
329 | const struct of_device_id *of_dev_id; | ||
330 | const struct fpd3_serdes_platform_data *pdata; | ||
331 | struct fpd3_serdes_data *data; | ||
332 | int status; | ||
333 | |||
334 | data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); | ||
335 | if (!data) | ||
336 | return -ENOMEM; | ||
337 | |||
338 | data->client = client; | ||
339 | i2c_set_clientdata(client, data); | ||
340 | |||
341 | fpd3_serdes_remove_conflict(client); | ||
342 | |||
343 | of_dev_id = of_match_device(fpd3_serdes_dt_ids, &client->dev); | ||
344 | if (!of_dev_id) { | ||
345 | dev_err(&client->dev, "Unable to match device"); | ||
346 | return -EINVAL; | ||
347 | } | ||
348 | pdata = of_dev_id->data; | ||
349 | data->pdata = pdata; | ||
350 | |||
351 | status = fpd3_serdes_of_probe(client, client->dev.of_node); | ||
352 | if (status) | ||
353 | goto fail; | ||
354 | |||
355 | if (data->slave_mode == false) { | ||
356 | status = fpd3_register_i2c_adapter(client); | ||
357 | if (status) { | ||
358 | dev_err(&client->dev, "Cannot register i2c adapter"); | ||
359 | goto fail; | ||
360 | } | ||
361 | } else { | ||
362 | status = fpd3_serdes_initialize(client); | ||
363 | if (status) | ||
364 | goto fail; | ||
365 | } | ||
366 | |||
367 | if (data->gpio_export == true) { | ||
368 | /* Register local gpios as a separate gpiochip */ | ||
369 | data->chip = fpd3_serdes_gpiochip; | ||
370 | data->chip.ngpio = pdata->ngpio; | ||
371 | data->chip.dev = &client->dev; | ||
372 | data->chip.label = client->name; | ||
373 | status = gpiochip_add(&data->chip); | ||
374 | if (status) | ||
375 | goto fail; | ||
376 | } | ||
377 | |||
378 | if (status) | ||
379 | goto unreg_gpio; | ||
380 | |||
381 | dev_err(&client->dev, "%s %s ready", pdata->dev_type == FPD3_SER_DEV ? | ||
382 | "Serializer" : "Deserializer", data->pdata->name); | ||
383 | |||
384 | return 0; | ||
385 | |||
386 | unreg_gpio: | ||
387 | if (data->gpio_export == true) { | ||
388 | gpiochip_remove(&data->chip); | ||
389 | return -1; | ||
390 | } | ||
391 | fail: | ||
392 | return status; | ||
393 | } | ||
394 | |||
395 | static int fpd3_serdes_remove(struct i2c_client *client) | ||
396 | { | ||
397 | struct fpd3_serdes_data *data = i2c_get_clientdata(client); | ||
398 | kfree(data); | ||
399 | |||
400 | return 0; | ||
401 | } | ||
402 | |||
403 | static struct i2c_driver fpd3_serdes_driver = { | ||
404 | .driver = { | ||
405 | .name = "fpd3_serdes", | ||
406 | .owner = THIS_MODULE, | ||
407 | .of_match_table = fpd3_serdes_dt_ids, | ||
408 | }, | ||
409 | .probe = fpd3_serdes_probe, | ||
410 | .remove = fpd3_serdes_remove, | ||
411 | .id_table = fpd3_serdes_i2c_ids | ||
412 | }; | ||
413 | module_i2c_driver(fpd3_serdes_driver); | ||
414 | |||
415 | MODULE_LICENSE("GPL"); | ||
416 | MODULE_AUTHOR("Nikhil Devshatwar"); | ||
diff --git a/drivers/video/serdes/fpd3_serdes.h b/drivers/video/serdes/fpd3_serdes.h new file mode 100644 index 000000000000..e5d05cdcf718 --- /dev/null +++ b/drivers/video/serdes/fpd3_serdes.h | |||
@@ -0,0 +1,108 @@ | |||
1 | #include <linux/kernel.h> | ||
2 | #include <linux/i2c.h> | ||
3 | #include <linux/gpio.h> | ||
4 | |||
5 | /* Deserializer registers */ | ||
6 | #define FPD3_DES_DEV_ID 0x00 | ||
7 | #define FPD3_DES_RESET 0x01 | ||
8 | #define FPD3_DES_CONFIG0 0x02 | ||
9 | #define FPD3_DES_CONFIG1 0x03 | ||
10 | |||
11 | #define FPD3_DES_SER_ID 0x06 | ||
12 | #define FPD3_DES_SER_AL 0x07 | ||
13 | #define FPD3_DES_SLAVE_ID0 0x08 | ||
14 | #define FPD3_DES_SLAVE_AL0 0x10 | ||
15 | |||
16 | #define FPD3_DES_GN_STS 0x1c | ||
17 | #define SIGNAL_DETECT (1<<1) | ||
18 | #define FPD3_DES_GPIO_01 0x1d | ||
19 | #define FPD3_DES_GPIO_23 0x1e | ||
20 | |||
21 | #define FPD3_DES_I2C_CTRL1 0x21 | ||
22 | #define FPD3_DES_I2C_CTRL2 0x22 | ||
23 | |||
24 | /* Serializer registers */ | ||
25 | #define FPD3_SER_DEV_ID 0x00 | ||
26 | #define FPD3_SER_RESET 0x01 | ||
27 | #define FPD3_SER_CONFIG0 0x02 | ||
28 | #define FPD3_SER_CONFIG1 0x03 | ||
29 | #define FPD3_SER_CONFIG2 0x04 | ||
30 | |||
31 | #define FPD3_SER_DES_ID 0x06 | ||
32 | #define FPD3_SER_DES_AL 0x06 | ||
33 | #define FPD3_SER_SLAVE_ID0 0x07 | ||
34 | #define FPD3_SER_SLAVE_AL0 0x08 | ||
35 | |||
36 | #define FPD3_SER_GN_STS 0x0c | ||
37 | #define SIGNAL_DETECT (1<<1) | ||
38 | #define FPD3_SER_GPIO_01 0x0d | ||
39 | #define FPD3_SER_GPIO_23 0x0e | ||
40 | |||
41 | #define FPD3_SER_DATA_CTRL 0x12 | ||
42 | #define FPD3_SER_I2C_CTRL1 0x21 | ||
43 | #define FPD3_SER_I2C_CTRL2 0x22 | ||
44 | |||
45 | /* Generic macros */ | ||
46 | #define GPIO_SHIFT_DIR 3 | ||
47 | #define GPIO_SHIFT_VAL 1 | ||
48 | #define GPIO_DIR_INPUT 1 | ||
49 | #define GPIO_DIR_OUTPUT 0 | ||
50 | |||
51 | #define FPD3_MAX_POLL_COUNT 100 | ||
52 | #define FPD3_SERDES_MAX_SLAVES 10 | ||
53 | |||
54 | enum fpd3_device_type { | ||
55 | FPD3_SER_DEV, | ||
56 | FPD3_DES_DEV, | ||
57 | }; | ||
58 | |||
59 | struct fpd3_serdes_data { | ||
60 | struct i2c_client *client; | ||
61 | bool slave_mode; | ||
62 | |||
63 | struct gpio_chip chip; | ||
64 | bool gpio_export; | ||
65 | |||
66 | struct i2c_adapter *adap; | ||
67 | unsigned int slave_addr[FPD3_SERDES_MAX_SLAVES]; | ||
68 | unsigned int slave_alias[FPD3_SERDES_MAX_SLAVES]; | ||
69 | const char *slave_name[FPD3_SERDES_MAX_SLAVES]; | ||
70 | int num_slaves; | ||
71 | int link_ok; | ||
72 | |||
73 | const struct fpd3_serdes_platform_data *pdata; | ||
74 | }; | ||
75 | |||
76 | struct fpd3_serdes_platform_data { | ||
77 | char *name; | ||
78 | enum fpd3_device_type dev_type; | ||
79 | int device_id; | ||
80 | int ngpio; | ||
81 | int nslaves; | ||
82 | int gpio_2reg; | ||
83 | const unsigned int *init_seq; | ||
84 | int init_len; | ||
85 | }; | ||
86 | |||
87 | static inline int i2c_write_le8(struct i2c_client *client, unsigned addr, | ||
88 | unsigned data) | ||
89 | { | ||
90 | int ret = i2c_smbus_write_byte_data(client, addr, data); | ||
91 | if (ret) | ||
92 | dev_dbg(&client->dev, "Failed to write 0x%02x to 0x%02x", | ||
93 | data, addr); | ||
94 | return ret; | ||
95 | } | ||
96 | |||
97 | static inline int i2c_read_le8(struct i2c_client *client, unsigned addr) | ||
98 | { | ||
99 | int ret = (int)i2c_smbus_read_byte_data(client, addr); | ||
100 | if (ret < 0) | ||
101 | dev_dbg(&client->dev, "Failed to read 0x%02x, Error = %d", | ||
102 | addr, ret); | ||
103 | return ret; | ||
104 | } | ||
105 | |||
106 | int fpd3_register_i2c_adapter(struct i2c_client *client); | ||
107 | int fpd3_serdes_initialize(struct i2c_client *client); | ||
108 | |||
diff --git a/firmware/Makefile b/firmware/Makefile index e297e1b52636..d019ab46c2cd 100644 --- a/firmware/Makefile +++ b/firmware/Makefile | |||
@@ -96,6 +96,9 @@ fw-shipped-$(CONFIG_SND_WAVEFRONT) += yamaha/yss225_registers.bin | |||
96 | fw-shipped-$(CONFIG_TEHUTI) += tehuti/bdx.bin | 96 | fw-shipped-$(CONFIG_TEHUTI) += tehuti/bdx.bin |
97 | fw-shipped-$(CONFIG_TIGON3) += tigon/tg3.bin tigon/tg3_tso.bin \ | 97 | fw-shipped-$(CONFIG_TIGON3) += tigon/tg3.bin tigon/tg3_tso.bin \ |
98 | tigon/tg3_tso5.bin | 98 | tigon/tg3_tso5.bin |
99 | |||
100 | fw-shipped-$(CONFIG_VIDEO_TI_VPDMA_LOAD_FW) += vpdma-1b8.bin | ||
101 | |||
99 | fw-shipped-$(CONFIG_TYPHOON) += 3com/typhoon.bin | 102 | fw-shipped-$(CONFIG_TYPHOON) += 3com/typhoon.bin |
100 | fw-shipped-$(CONFIG_USB_EMI26) += emi26/loader.fw emi26/firmware.fw \ | 103 | fw-shipped-$(CONFIG_USB_EMI26) += emi26/loader.fw emi26/firmware.fw \ |
101 | emi26/bitstream.fw | 104 | emi26/bitstream.fw |
diff --git a/firmware/vpdma-1b8.bin.ihex b/firmware/vpdma-1b8.bin.ihex new file mode 100644 index 000000000000..ddf307dd3e29 --- /dev/null +++ b/firmware/vpdma-1b8.bin.ihex | |||
@@ -0,0 +1,252 @@ | |||
1 | :10000000064B408007680749064A005102441F0812 | ||
2 | :10001000064A003102441E080449418004484080D9 | ||
3 | :100020000680000C01D002C01681010000441C08AB | ||
4 | :1000300001441D080649E809064818080185064AD2 | ||
5 | :1000400001002181219400441B080044180806483F | ||
6 | :10005000010000441A080648001C0044190806491B | ||
7 | :1000600000000144250801442408064818080144FA | ||
8 | :100070002108004420080648E809068001000144E0 | ||
9 | :100080002308004422080144260806480080004452 | ||
10 | :100090002708064834000044428006480000004417 | ||
11 | :1000A000F880064801000044F980064B1808864B8A | ||
12 | :1000B000200807BC0FB80004064801000044FF8078 | ||
13 | :1000C0000648FFFF0044F8800648FFFF0044F9801F | ||
14 | :1000D000064800000044580800445D0800445E08DB | ||
15 | :1000E00000445F0800445C08004457090044590973 | ||
16 | :1000F00000445A0900445B0900445C0900445D095E | ||
17 | :1001000000445E0900445F09004460090044660938 | ||
18 | :10011000004465090648D1000044E18006486A02AF | ||
19 | :100120000044E2800648F9050044E3800648B8012F | ||
20 | :100130000044FC800044FE800004064800000044A7 | ||
21 | :10014000540900445509004456090448FE8006AA93 | ||
22 | :1001500008000649010001940044FF80864B5909BC | ||
23 | :10016000C483FE800F480ECC064B01800648080071 | ||
24 | :1001700004A8FE80308307480689F0011685F00147 | ||
25 | :1001800001C881450649FF010144FD800FB90649B8 | ||
26 | :1001900042802183074A26867F00CCCC0448E08039 | ||
27 | :1001A00000E00648FFFF0044F880064B59093483FD | ||
28 | :1001B000FE80064A00000245044AFE8002446108AF | ||
29 | :1001C00026A9050001446808064B32081383074836 | ||
30 | :1001D0000044630826A9080001446708064B4080D4 | ||
31 | :1001E000138307680044650807480044660836839F | ||
32 | :1001F000030007480680F9FF03CC064AD70502E052 | ||
33 | :100200000648000000446408064B300826A9050093 | ||
34 | :100210001383076800445D0800445C080045064BF2 | ||
35 | :1002200033081383074800445F080648510100E083 | ||
36 | :1002300004486708064B43803083074932CC044AA0 | ||
37 | :10024000FE80064B6709238306481F010045864B45 | ||
38 | :100250004280C48367080F4836830800004506487B | ||
39 | :100260007F008045064B0180348367080648FFFF06 | ||
40 | :1002700000450448540912C806488001044955093C | ||
41 | :10028000018C0045068C80000044FC80064B34083D | ||
42 | :1002900026AA05003283064800000045064897015B | ||
43 | :1002A00000E0044AFE80064B6709238306481801D4 | ||
44 | :1002B0000045044AFE8006490800064B018012AA48 | ||
45 | :1002C0002383064801010045864B0F080F4A0DD8CD | ||
46 | :1002D000064800010045864B07080F4A06D8064825 | ||
47 | :1002E000FA0100450044FF8025C00448FE8006A8AE | ||
48 | :1002F0000500064B34080383044964080145064B96 | ||
49 | :100300003108038304495D08014506480080004424 | ||
50 | :10031000FA80064A000002449108044AFE80064B17 | ||
51 | :100320006709238306481801068C008000450648AB | ||
52 | :100330009A0000E00649005106480001108C004474 | ||
53 | :100340001F08044A660802441D080244D18004497B | ||
54 | :10035000650801441C080144D08004486308064B2A | ||
55 | :100360004380348367080749018603D80244620842 | ||
56 | :1003700006C016800000064A00000244620804829B | ||
57 | :10038000640802446408044A640806A81000004493 | ||
58 | :100390001B08004418080044D280064801000044AD | ||
59 | :1003A000D380064A000004495C0802442508014441 | ||
60 | :1003B00024080449910807C806490000014491082F | ||
61 | :1003C00004495C0805C00449920802CC04495D0850 | ||
62 | :1003D0000244210801442008064900000144920813 | ||
63 | :1003E00004495F0802442308014422080244260805 | ||
64 | :1003F0000649008001442708864B18080FBE0448B0 | ||
65 | :100400006208064B4380348367080045864B20080A | ||
66 | :100410000448D480004465080448D5800044660838 | ||
67 | :100420000FB806483400064B42800449670813831E | ||
68 | :100430000045044AFE80064B6709238306491801DC | ||
69 | :10044000168D0040014536830800004536830800BC | ||
70 | :1004500004485D080045064B43803483670807491C | ||
71 | :100460000448FE80064B6709038336831800014564 | ||
72 | :1004700004496708064B40801383044865080065FB | ||
73 | :100480000448660800450448FE8006A80500064B9F | ||
74 | :1004900034080383044964080145064B310803838B | ||
75 | :1004A00004495D0801450648970100E006480080C0 | ||
76 | :1004B0000044FA80044AFE80064B670923830648FD | ||
77 | :1004C0001801068C00C0004506489A0000E0004470 | ||
78 | :1004D000EE8000E4044AFE80064B018026A9080055 | ||
79 | :1004E00001446708064B4080138307680044650891 | ||
80 | :1004F0000768004466080768076800446208074800 | ||
81 | :10050000004460080244610826AA05000244680805 | ||
82 | :10051000064B30082383076800445C0807680044E2 | ||
83 | :100520005D08076800445E08076800445F080748E4 | ||
84 | :1005300000446408004463080448640807CC044885 | ||
85 | :100540005E08004463080648180100E0044B5D089B | ||
86 | :100550000649F5FF368307000748109406490A004C | ||
87 | :1005600010840CC80649010010840BC8108403C80D | ||
88 | :100570000648C40200E006488E0400E00648DC029B | ||
89 | :1005800000E00648CC0300E036830800044A5D081A | ||
90 | :10059000024536830800044A640802450448FE8088 | ||
91 | :1005A00006490800864B018010A888830648FB0195 | ||
92 | :1005B000804506489A0000E0044A640806CC0648D4 | ||
93 | :1005C0008A0300E006487C0300E0044A64082680B1 | ||
94 | :1005D000FFFFF8C8044B5D08B68306000F48068885 | ||
95 | :1005E000004000448F080F480688008000445409EA | ||
96 | :1005F000B68307000F480688FF01044AFE800649BB | ||
97 | :100600000800864B018012AAA88380450649030092 | ||
98 | :100610009097C68307000F4A05D8B68306000F4A95 | ||
99 | :1006200004D808C006489B0300E09097C6830200E8 | ||
100 | :100630000F49F8D8044AFE80864B0180064908001D | ||
101 | :1006400012AAA8830649FE0181450144FF8007BD27 | ||
102 | :10065000064903009097C68302000F49168D00805B | ||
103 | :10066000814536830800044954090DC80649030032 | ||
104 | :100670009097C68307000F491689008004488F08A9 | ||
105 | :10068000108D01448F0806480100044A5609209441 | ||
106 | :10069000044A5509028E02445509044A5F0823851D | ||
107 | :1006A00004D8044B5C0803445D0804498F0805C85E | ||
108 | :1006B00007B81689000001448F0807B83683080080 | ||
109 | :1006C00006480100044A56092681010001445609E2 | ||
110 | :1006D000044964081681FEFF0144640823C8044AE3 | ||
111 | :1006E0005F08328505D803445D080648A60200E08D | ||
112 | :1006F00004485C0800445D0804485D0804495F083C | ||
113 | :100700000680080000449208108404D806480100BE | ||
114 | :100710000044910804485E080649FFFF1094004415 | ||
115 | :10072000630834C004485C0800445D0804485E085F | ||
116 | :10073000004463082BC0B68306000F4801D810C0E0 | ||
117 | :10074000044AFE80864B01800649080012AAA8834D | ||
118 | :100750000648FE0180450044FF8036831000B0C08B | ||
119 | :1007600004486808064B34080383044964080145BB | ||
120 | :10077000064B3108038304495D0801450AC0064859 | ||
121 | :10078000100000448E080648670200E00648180181 | ||
122 | :1007900000E006489A0000E0044A640803CC0648DA | ||
123 | :1007A000500400E0044B5D08B68306000F4869C89A | ||
124 | :1007B000064A000004495C08024425080144240854 | ||
125 | :1007C00004495D08024421080144200804495F08E7 | ||
126 | :1007D00002442308014422080244260806490080F6 | ||
127 | :1007E00001442708044AFE8006490800064B0180A0 | ||
128 | :1007F00012AA238306480101064900800045864B62 | ||
129 | :100800000F080F4A59D80648000106490040004524 | ||
130 | :10081000864B07080F4A50D8064901010144FD8064 | ||
131 | :100820000044FF800648FC010045044B5D0807BCFE | ||
132 | :10083000B68306000F680F49168AFF011689000467 | ||
133 | :1008400003C80680010002C006480100864B4280B2 | ||
134 | :10085000C483670806493E00218181450449640834 | ||
135 | :1008600001850144640806A80800308202445D083E | ||
136 | :10087000064B2008864B080807B90F490F490F4956 | ||
137 | :100880000AC004485D08068008000449640816810F | ||
138 | :10089000FFFF06C834C004495F08218526D814C06C | ||
139 | :1008A0000144640804495E08064AFFFF2196024499 | ||
140 | :1008B00063080648180100E0064800800044FA80FA | ||
141 | :1008C0000648FF800044F98004486808064B340855 | ||
142 | :1008D0000383044964080145064B31080383044936 | ||
143 | :1008E0005D08014506489A0000E004485C080044A1 | ||
144 | :1008F0005D08044A5E0804496408D2C8E5C0064B96 | ||
145 | :10090000310834836808004500445D0836830300DD | ||
146 | :100910000145014464080648A60200E0044AFE803E | ||
147 | :10092000044B5D0836830600074806880F000BC895 | ||
148 | :1009300006490100108421C810842DC810843BC8CA | ||
149 | :1009400010843FC87BC036830100044AFE800748FC | ||
150 | :100950000688FF01864B9308C6830100C0830F49B8 | ||
151 | :10096000068C00800044FD8007B8864B4280064814 | ||
152 | :10097000080002AAA88381456FC0044AFE80064988 | ||
153 | :100980000800864BF080A88336830100074806885C | ||
154 | :10099000FF01804561C0044AFE8006490800864B7D | ||
155 | :1009A000428012A9C183138307480688FF0126826B | ||
156 | :1009B0004700824551C03683FAFF07480044FB8058 | ||
157 | :1009C0004BC0044AFE8006490800864B018012AAEB | ||
158 | :1009D000A8833683010007480688FF01804506ABDF | ||
159 | :1009E00008003683070007491689008009CC368342 | ||
160 | :1009F000FCFF0749168A008008C8168A004005CC0B | ||
161 | :100A000004485D080449640832C00648FE01804578 | ||
162 | :100A10000044FF80044B5D083683080076C03683AF | ||
163 | :100A2000010007480688FF01068C00803683F9FF25 | ||
164 | :100A30000044FD8007B83683080067C01084EFC803 | ||
165 | :100A4000108418C8108422C810843EC8108453C86B | ||
166 | :100A50001084064AC90502E004485D0806800800C3 | ||
167 | :100A6000044964081681FFFF04865F0863D8064ABC | ||
168 | :100A7000BE0502E00649FCFF3683010007680688D0 | ||
169 | :100A8000FF010044EE800648850500E0064A0000AC | ||
170 | :100A900002449108044AFE8006490800864B4080C3 | ||
171 | :100AA00012AAA883064806000387076880650768BE | ||
172 | :100AB0008065C683010007488045064A000002445D | ||
173 | :100AC00064080648DC0000E0076907490648FF01A2 | ||
174 | :100AD000108906480000864B7E0880658165806528 | ||
175 | :100AE00080658065806580658065864B7E080FBC6B | ||
176 | :100AF000368301000AC03683FEFF07480688FF01DF | ||
177 | :100B00000044FA803683040000C00448640806806C | ||
178 | :100B1000FFFF15C80044640804495F0803445D08EA | ||
179 | :100B2000318403D80648A60200E004485C0800446B | ||
180 | :100B30005D08F8C004485C0800445D081FC0044814 | ||
181 | :100B40005E080044630804495F0803445D0831847B | ||
182 | :100B500003D80648180100E004485C0800445D081A | ||
183 | :100B60000648180100E004485C0800445D08044899 | ||
184 | :100B70005E080044630806489A0000E0064B31080E | ||
185 | :100B800034836808004536830300014506489A000F | ||
186 | :100B900000E00448FE8006490800864B018010A84A | ||
187 | :100BA00088830648FD01804506489A0000E0044A13 | ||
188 | :100BB0006708064B4080328307680649FFFF90971D | ||
189 | :100BC000074A268A010002C8C68F00800F4A06889D | ||
190 | :100BD000010003C80649F8FF12960448FE80064942 | ||
191 | :100BE0000800864B018010A888838245064A9A0037 | ||
192 | :100BF00002E006489A0000E000000000000000004B | ||
193 | :100C00000000001C01001000020000000031005133 | ||
194 | :100C100000000000000000000000000000000000D4 | ||
195 | :100C200000000000000000000000000000000000C4 | ||
196 | :100C3000001000104000FF110000001200124000E0 | ||
197 | :100C4000FF130000001400144000FF150000001600 | ||
198 | :100C500000164000FF170000001800184000FF19A0 | ||
199 | :100C60000000001A001A4000FF1B0000001C001CBE | ||
200 | :100C70004000FF1D0000001E001E4000FF1F00007E | ||
201 | :100C80000000000000000000000000000000000064 | ||
202 | :100C90000000000000000000000000000000000054 | ||
203 | :100CA0000000000000000000000000000000000044 | ||
204 | :100CB0000000000000000000000000000000000034 | ||
205 | :100CC0000000000000000000000000000000000420 | ||
206 | :100CD0000000000000000000000000000000000014 | ||
207 | :100CE0000000000000000000000000000000000004 | ||
208 | :100CF000000000000000000D0100000002000300E1 | ||
209 | :100D00000400050006000700080009000A000B00A7 | ||
210 | :100D10000C000D000E000F00100011001400130055 | ||
211 | :100D2000150016001700180019001A001B001C00FF | ||
212 | :100D30001D001F00200021002A002B002C002A008B | ||
213 | :100D40002B002C0022002200220022002200220080 | ||
214 | :100D50002200220022002200220022002200220083 | ||
215 | :100D6000220022002300230023002300230023006D | ||
216 | :100D7000230023002300230023002300230023005B | ||
217 | :100D8000230023003A003A003A003A003A003A00C1 | ||
218 | :100D90003A003A003A003A003A003A003A003A0083 | ||
219 | :100DA0003A003A003B003B003B003B003B003B006D | ||
220 | :100DB0003B003B003B003B003B003B003B003B005B | ||
221 | :100DC0003B003B00240025002200230024002200D9 | ||
222 | :100DD00026002600260026002600260026002600E3 | ||
223 | :100DE00026002600260026002600260026002600D3 | ||
224 | :100DF00027002700270027002700270027002700BB | ||
225 | :100E000027002700270027002700270027002700AA | ||
226 | :100E10003C003C003C003C003C003C003C003C00F2 | ||
227 | :100E20003C003C003C003C003C003C003C003C00E2 | ||
228 | :100E30003D003D003D003D003D003D003D003D00CA | ||
229 | :100E40003D003D003D003D003D003D003D003D00BA | ||
230 | :100E50002800290026002700280026002D00300049 | ||
231 | :100E600031002E002F0032003300350012001E002A | ||
232 | :100E70003700360039003800000000000000000094 | ||
233 | :100E80000000000000000000000000000000000062 | ||
234 | :100E90000000000000000000000000000000000052 | ||
235 | :100EA0000000000000000000000000000000000042 | ||
236 | :100EB0000000000000000000000000000000000032 | ||
237 | :100EC0000000000000000000000000000000000022 | ||
238 | :100ED0000000000000000000000000000000000012 | ||
239 | :100EE0000000000000000000000000000000000002 | ||
240 | :100EF00000000000000000000000000000000000F2 | ||
241 | :100F000000000000000000000000000000000000E1 | ||
242 | :100F100000000000000000000000000000000000D1 | ||
243 | :100F200000000000000000000000000000000000C1 | ||
244 | :100F300000000000000000000000000000000000B1 | ||
245 | :100F400000000000000000000000000000000000A1 | ||
246 | :100F50000000000000000000000000000000000091 | ||
247 | :100F60000000000000000000000000000000000081 | ||
248 | :100F70000000000000000000000000000000000071 | ||
249 | :100F80000000000000000000000000000000000061 | ||
250 | :100F90000000000000000000000000000000000051 | ||
251 | :020FA00000004F | ||
252 | :00000001FF | ||
diff --git a/include/linux/hwspinlock.h b/include/linux/hwspinlock.h index 859d673d98c8..b32e4898710f 100644 --- a/include/linux/hwspinlock.h +++ b/include/linux/hwspinlock.h | |||
@@ -24,6 +24,7 @@ | |||
24 | /* hwspinlock mode argument */ | 24 | /* hwspinlock mode argument */ |
25 | #define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */ | 25 | #define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */ |
26 | #define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */ | 26 | #define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */ |
27 | #define HWLOCK_MUTEX 0x03 /* Use a mutex for contexts that sleep */ | ||
27 | 28 | ||
28 | struct device; | 29 | struct device; |
29 | struct device_node; | 30 | struct device_node; |
@@ -242,6 +243,12 @@ int hwspin_lock_timeout_irq(struct hwspinlock *hwlock, unsigned int to) | |||
242 | return __hwspin_lock_timeout(hwlock, to, HWLOCK_IRQ, NULL); | 243 | return __hwspin_lock_timeout(hwlock, to, HWLOCK_IRQ, NULL); |
243 | } | 244 | } |
244 | 245 | ||
246 | static inline | ||
247 | int hwspin_lock_timeout_can_sleep(struct hwspinlock *hwlock, unsigned int to) | ||
248 | { | ||
249 | return __hwspin_lock_timeout(hwlock, to, HWLOCK_MUTEX, NULL); | ||
250 | } | ||
251 | |||
245 | /** | 252 | /** |
246 | * hwspin_lock_timeout() - lock an hwspinlock with timeout limit | 253 | * hwspin_lock_timeout() - lock an hwspinlock with timeout limit |
247 | * @hwlock: the hwspinlock to be locked | 254 | * @hwlock: the hwspinlock to be locked |
@@ -301,6 +308,11 @@ static inline void hwspin_unlock_irq(struct hwspinlock *hwlock) | |||
301 | __hwspin_unlock(hwlock, HWLOCK_IRQ, NULL); | 308 | __hwspin_unlock(hwlock, HWLOCK_IRQ, NULL); |
302 | } | 309 | } |
303 | 310 | ||
311 | static inline void hwspin_unlock_can_sleep(struct hwspinlock *hwlock) | ||
312 | { | ||
313 | __hwspin_unlock(hwlock, HWLOCK_MUTEX, NULL); | ||
314 | } | ||
315 | |||
304 | /** | 316 | /** |
305 | * hwspin_unlock() - unlock hwspinlock | 317 | * hwspin_unlock() - unlock hwspinlock |
306 | * @hwlock: a previously-acquired hwspinlock which we want to unlock | 318 | * @hwlock: a previously-acquired hwspinlock which we want to unlock |
diff --git a/include/linux/platform_data/davinci_asp.h b/include/linux/platform_data/davinci_asp.h index 85ad68f9206a..4ed28436d187 100644 --- a/include/linux/platform_data/davinci_asp.h +++ b/include/linux/platform_data/davinci_asp.h | |||
@@ -86,6 +86,8 @@ struct davinci_mcasp_pdata { | |||
86 | u8 rxnumevt; | 86 | u8 rxnumevt; |
87 | int tx_dma_channel; | 87 | int tx_dma_channel; |
88 | int rx_dma_channel; | 88 | int rx_dma_channel; |
89 | |||
90 | bool shared_dai; | ||
89 | }; | 91 | }; |
90 | /* TODO: Fix arch/arm/mach-davinci/ users and remove this define */ | 92 | /* TODO: Fix arch/arm/mach-davinci/ users and remove this define */ |
91 | #define snd_platform_data davinci_mcasp_pdata | 93 | #define snd_platform_data davinci_mcasp_pdata |
diff --git a/include/uapi/linux/hwspinlock_user.h b/include/uapi/linux/hwspinlock_user.h new file mode 100644 index 000000000000..68f3dff70c7f --- /dev/null +++ b/include/uapi/linux/hwspinlock_user.h | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | * Userspace interface to hardware spinlocks | ||
3 | * | ||
4 | * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com | ||
5 | * | ||
6 | * Redistribution and use in source and binary forms, with or without | ||
7 | * modification, are permitted provided that the following conditions | ||
8 | * are met: | ||
9 | * | ||
10 | * * Redistributions of source code must retain the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer. | ||
12 | * * Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in | ||
14 | * the documentation and/or other materials provided with the | ||
15 | * distribution. | ||
16 | * * Neither the name Texas Instruments nor the names of its | ||
17 | * contributors may be used to endorse or promote products derived | ||
18 | * from this software without specific prior written permission. | ||
19 | * | ||
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
24 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
31 | */ | ||
32 | |||
33 | #ifndef _UAPI_HWSPINLOCK_USER_H | ||
34 | #define _UAPI_HWSPINLOCK_USER_H | ||
35 | |||
36 | #include <linux/ioctl.h> | ||
37 | |||
38 | /** | ||
39 | * struct hwspinlock_user_lock - Sent to lock a specific hwspinlock | ||
40 | * @id: hardware spinlock id | ||
41 | * @timeout: timeout value in msecs | ||
42 | */ | ||
43 | struct hwspinlock_user_lock { | ||
44 | int id; | ||
45 | unsigned int timeout; | ||
46 | }; | ||
47 | |||
48 | /** | ||
49 | * struct hwspinlock_user_unlock - Sent to unlock a specific hwspinlock | ||
50 | * @id: hardware spinlock id | ||
51 | */ | ||
52 | struct hwspinlock_user_unlock { | ||
53 | int id; | ||
54 | }; | ||
55 | |||
56 | #define HWSPINLOCK_IOC_MAGIC 'h' | ||
57 | |||
58 | #define HWSPINLOCK_USER_LOCK _IOW(HWSPINLOCK_IOC_MAGIC, 0, \ | ||
59 | struct hwspinlock_user_lock) | ||
60 | #define HWSPINLOCK_USER_UNLOCK _IOW(HWSPINLOCK_IOC_MAGIC, 1, \ | ||
61 | struct hwspinlock_user_unlock) | ||
62 | |||
63 | #endif /* _UAPI_HWSPINLOCK_USER_H */ | ||
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index c159042b1eb6..426dd52f6a05 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
@@ -1713,6 +1713,11 @@ static struct davinci_mcasp_pdata *davinci_mcasp_set_pdata_from_of( | |||
1713 | if (ret >= 0) | 1713 | if (ret >= 0) |
1714 | pdata->sram_size_capture = val; | 1714 | pdata->sram_size_capture = val; |
1715 | 1715 | ||
1716 | if (of_find_property(np, "shared-dai", NULL)) | ||
1717 | pdata->shared_dai = 1; | ||
1718 | else | ||
1719 | pdata->shared_dai = 0; | ||
1720 | |||
1716 | return pdata; | 1721 | return pdata; |
1717 | 1722 | ||
1718 | nodata: | 1723 | nodata: |
@@ -1957,6 +1962,15 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
1957 | 1962 | ||
1958 | pm_runtime_enable(&pdev->dev); | 1963 | pm_runtime_enable(&pdev->dev); |
1959 | 1964 | ||
1965 | /* | ||
1966 | * Forbid runtime PM if the DAI is shared, data transfers will occur | ||
1967 | * from a different core (typically DSP). | ||
1968 | */ | ||
1969 | if (pdata->shared_dai) { | ||
1970 | dev_info(&pdev->dev, "DAI is shared\n"); | ||
1971 | pm_runtime_forbid(&pdev->dev); | ||
1972 | } | ||
1973 | |||
1960 | mcasp->op_mode = pdata->op_mode; | 1974 | mcasp->op_mode = pdata->op_mode; |
1961 | /* sanity check for tdm slots parameter */ | 1975 | /* sanity check for tdm slots parameter */ |
1962 | if (mcasp->op_mode == DAVINCI_MCASP_IIS_MODE) { | 1976 | if (mcasp->op_mode == DAVINCI_MCASP_IIS_MODE) { |
@@ -1986,51 +2000,58 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
1986 | 2000 | ||
1987 | mcasp->dev = &pdev->dev; | 2001 | mcasp->dev = &pdev->dev; |
1988 | 2002 | ||
1989 | irq = platform_get_irq_byname(pdev, "common"); | 2003 | /* |
1990 | if (irq >= 0) { | 2004 | * Do not register IRQ if DAI is shared, as the remote core will |
1991 | irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s_common", | 2005 | * be responsible for servicing these interrupts. |
1992 | dev_name(&pdev->dev)); | 2006 | */ |
1993 | ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, | 2007 | if (!pdata->shared_dai) { |
1994 | davinci_mcasp_common_irq_handler, | 2008 | irq = platform_get_irq_byname(pdev, "common"); |
1995 | IRQF_ONESHOT | IRQF_SHARED, | 2009 | if (irq >= 0) { |
1996 | irq_name, mcasp); | 2010 | irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, |
1997 | if (ret) { | 2011 | "%s_common", dev_name(&pdev->dev)); |
1998 | dev_err(&pdev->dev, "common IRQ request failed\n"); | 2012 | ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, |
1999 | goto err; | 2013 | davinci_mcasp_common_irq_handler, |
2000 | } | 2014 | IRQF_ONESHOT | IRQF_SHARED, |
2015 | irq_name, mcasp); | ||
2016 | if (ret) { | ||
2017 | dev_err(&pdev->dev, | ||
2018 | "common IRQ request failed\n"); | ||
2019 | goto err; | ||
2020 | } | ||
2001 | 2021 | ||
2002 | mcasp->irq_request[SNDRV_PCM_STREAM_PLAYBACK] = XUNDRN; | 2022 | mcasp->irq_request[SNDRV_PCM_STREAM_PLAYBACK] = XUNDRN; |
2003 | mcasp->irq_request[SNDRV_PCM_STREAM_CAPTURE] = ROVRN; | 2023 | mcasp->irq_request[SNDRV_PCM_STREAM_CAPTURE] = ROVRN; |
2004 | } | 2024 | } |
2005 | 2025 | ||
2006 | irq = platform_get_irq_byname(pdev, "rx"); | 2026 | irq = platform_get_irq_byname(pdev, "rx"); |
2007 | if (irq >= 0) { | 2027 | if (irq >= 0) { |
2008 | irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s_rx", | 2028 | irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, |
2009 | dev_name(&pdev->dev)); | 2029 | "%s_rx", dev_name(&pdev->dev)); |
2010 | ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, | 2030 | ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, |
2011 | davinci_mcasp_rx_irq_handler, | 2031 | davinci_mcasp_rx_irq_handler, |
2012 | IRQF_ONESHOT, irq_name, mcasp); | 2032 | IRQF_ONESHOT, irq_name, mcasp); |
2013 | if (ret) { | 2033 | if (ret) { |
2014 | dev_err(&pdev->dev, "RX IRQ request failed\n"); | 2034 | dev_err(&pdev->dev, "RX IRQ request failed\n"); |
2015 | goto err; | 2035 | goto err; |
2016 | } | 2036 | } |
2017 | 2037 | ||
2018 | mcasp->irq_request[SNDRV_PCM_STREAM_CAPTURE] = ROVRN; | 2038 | mcasp->irq_request[SNDRV_PCM_STREAM_CAPTURE] = ROVRN; |
2019 | } | 2039 | } |
2020 | 2040 | ||
2021 | irq = platform_get_irq_byname(pdev, "tx"); | 2041 | irq = platform_get_irq_byname(pdev, "tx"); |
2022 | if (irq >= 0) { | 2042 | if (irq >= 0) { |
2023 | irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s_tx", | 2043 | irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, |
2024 | dev_name(&pdev->dev)); | 2044 | "%s_tx", dev_name(&pdev->dev)); |
2025 | ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, | 2045 | ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, |
2026 | davinci_mcasp_tx_irq_handler, | 2046 | davinci_mcasp_tx_irq_handler, |
2027 | IRQF_ONESHOT, irq_name, mcasp); | 2047 | IRQF_ONESHOT, irq_name, mcasp); |
2028 | if (ret) { | 2048 | if (ret) { |
2029 | dev_err(&pdev->dev, "TX IRQ request failed\n"); | 2049 | dev_err(&pdev->dev, "TX IRQ request failed\n"); |
2030 | goto err; | 2050 | goto err; |
2031 | } | 2051 | } |
2032 | 2052 | ||
2033 | mcasp->irq_request[SNDRV_PCM_STREAM_PLAYBACK] = XUNDRN; | 2053 | mcasp->irq_request[SNDRV_PCM_STREAM_PLAYBACK] = XUNDRN; |
2054 | } | ||
2034 | } | 2055 | } |
2035 | 2056 | ||
2036 | dat = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dat"); | 2057 | dat = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dat"); |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 6d442f114136..0124eedcaaa3 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1082,6 +1082,15 @@ static void soc_set_name_prefix(struct snd_soc_card *card, | |||
1082 | struct snd_soc_component *component) | 1082 | struct snd_soc_component *component) |
1083 | { | 1083 | { |
1084 | int i; | 1084 | int i; |
1085 | int ret; | ||
1086 | |||
1087 | if (component->dev->of_node) { | ||
1088 | ret = of_property_read_string(component->dev->of_node, | ||
1089 | "name-prefix", | ||
1090 | &component->name_prefix); | ||
1091 | if (ret == 0) | ||
1092 | return; | ||
1093 | } | ||
1085 | 1094 | ||
1086 | if (card->codec_conf == NULL) | 1095 | if (card->codec_conf == NULL) |
1087 | return; | 1096 | return; |
diff --git a/ti_config_fragments/audio_display.cfg b/ti_config_fragments/audio_display.cfg index a7cb1c83e79e..5174ca787eb5 100644 --- a/ti_config_fragments/audio_display.cfg +++ b/ti_config_fragments/audio_display.cfg | |||
@@ -55,6 +55,7 @@ CONFIG_DISPLAY_DRA7EVM_ENCODER_TPD12S015=y | |||
55 | CONFIG_DISPLAY_ENCODER_TPD12S015=y | 55 | CONFIG_DISPLAY_ENCODER_TPD12S015=y |
56 | CONFIG_DISPLAY_ENCODER_SII9022=y | 56 | CONFIG_DISPLAY_ENCODER_SII9022=y |
57 | CONFIG_DISPLAY_ENCODER_TC358768=y | 57 | CONFIG_DISPLAY_ENCODER_TC358768=y |
58 | CONFIG_VIDEO_TI_FPD3_SERDES=y | ||
58 | CONFIG_DISPLAY_ENCODER_TFP410=y | 59 | CONFIG_DISPLAY_ENCODER_TFP410=y |
59 | 60 | ||
60 | # sound | 61 | # sound |
diff --git a/ti_config_fragments/auto.cfg b/ti_config_fragments/auto.cfg new file mode 100644 index 000000000000..dee32023602b --- /dev/null +++ b/ti_config_fragments/auto.cfg | |||
@@ -0,0 +1,43 @@ | |||
1 | ################################################## | ||
2 | # TI automotive config options | ||
3 | ################################################## | ||
4 | |||
5 | # | ||
6 | # Connectivity options | ||
7 | # | ||
8 | CONFIG_TOUCHSCREEN_EDT_FT5X06=y | ||
9 | |||
10 | # | ||
11 | # Audio/Display options | ||
12 | # | ||
13 | CONFIG_SND_SIMPLE_CARD=y | ||
14 | CONFIG_SND_SOC_TLV320AIC3X=y | ||
15 | CONFIG_SND_SOC_HDMI_CODEC=y | ||
16 | CONFIG_SND_OMAP_SOC_HDMI_AUDIO=y | ||
17 | |||
18 | #Hardware spinlock | ||
19 | CONFIG_HWSPINLOCK_USER=y | ||
20 | |||
21 | #User-space I/O | ||
22 | CONFIG_UIO=y | ||
23 | CONFIG_UIO_PDRV_GENIRQ=y | ||
24 | |||
25 | #Video subsystem options | ||
26 | CONFIG_VIDEO_TI_CAL=y | ||
27 | CONFIG_VIDEO_TI_VIP=y | ||
28 | CONFIG_VIDEO_TI_VPE=y | ||
29 | CONFIG_VIDEO_TI_VPDMA_HELPER=y | ||
30 | CONFIG_VIDEO_TI_VPDMA_LOAD_FW=y | ||
31 | CONFIG_VIDEO_OV1063X=y | ||
32 | CONFIG_GPIO_PCA953X=y | ||
33 | CONFIG_VIDEO_OV490=y | ||
34 | |||
35 | #JAMR and Vision options | ||
36 | CONFIG_VIDEO_TVP5158=y | ||
37 | CONFIG_GPIO_MCP23S08=y | ||
38 | |||
39 | #Debug related | ||
40 | CONFIG_DEBUG_LL=y | ||
41 | CONFIG_DEBUG_OMAP2UART1=y | ||
42 | CONFIG_EARLY_PRINTK=y | ||
43 | CONFIG_DEBUG_GPIO=n | ||
diff --git a/ti_config_fragments/connectivity.cfg b/ti_config_fragments/connectivity.cfg index 621ae1945515..bcccc78a1e73 100644 --- a/ti_config_fragments/connectivity.cfg +++ b/ti_config_fragments/connectivity.cfg | |||
@@ -300,6 +300,7 @@ CONFIG_TOUCHSCREEN_PIXCIR=m | |||
300 | CONFIG_TOUCHSCREEN_TI_AM335X_TSC=m | 300 | CONFIG_TOUCHSCREEN_TI_AM335X_TSC=m |
301 | CONFIG_TOUCHSCREEN_GOODIX=m | 301 | CONFIG_TOUCHSCREEN_GOODIX=m |
302 | CONFIG_TI_AM335X_ADC=m | 302 | CONFIG_TI_AM335X_ADC=m |
303 | CONFIG_TOUCHSCREEN_LDC3001=y | ||
303 | 304 | ||
304 | #QSPI | 305 | #QSPI |
305 | CONFIG_SPI_CADENCE_QUADSPI=m | 306 | CONFIG_SPI_CADENCE_QUADSPI=m |
diff --git a/ti_config_fragments/defconfig_map.txt b/ti_config_fragments/defconfig_map.txt index 5a0ed65087ec..e28c904d89b0 100644 --- a/ti_config_fragments/defconfig_map.txt +++ b/ti_config_fragments/defconfig_map.txt | |||
@@ -1,7 +1,7 @@ | |||
1 | # Release Defconfigs | 1 | # Release Defconfigs |
2 | classification: SDK_Release_Defconfigs type: ti_sdk_am3x_release defconfig: multi_v7_defconfig config_file: None extra_configs: multi_v7_prune.cfg baseport.cfg ipc.cfg connectivity.cfg audio_display.cfg wlan.cfg omap_soc.cfg am33xx_only.cfg systemd.cfg | 2 | classification: SDK_Release_Defconfigs type: ti_sdk_am3x_release defconfig: multi_v7_defconfig config_file: None extra_configs: multi_v7_prune.cfg baseport.cfg ipc.cfg connectivity.cfg audio_display.cfg wlan.cfg omap_soc.cfg am33xx_only.cfg systemd.cfg |
3 | classification: SDK_Release_Defconfigs type: ti_sdk_am4x_release defconfig: multi_v7_defconfig config_file: None extra_configs: multi_v7_prune.cfg baseport.cfg ipc.cfg connectivity.cfg audio_display.cfg wlan.cfg omap_soc.cfg am43xx_only.cfg systemd.cfg | 3 | classification: SDK_Release_Defconfigs type: ti_sdk_am4x_release defconfig: multi_v7_defconfig config_file: None extra_configs: multi_v7_prune.cfg baseport.cfg ipc.cfg connectivity.cfg audio_display.cfg wlan.cfg omap_soc.cfg am43xx_only.cfg systemd.cfg |
4 | classification: SDK_Release_Defconfigs type: ti_sdk_dra7x_release defconfig: multi_v7_defconfig config_file: None extra_configs: multi_v7_prune.cfg baseport.cfg ipc.cfg connectivity.cfg audio_display.cfg wlan.cfg omap_soc.cfg lpae.cfg dra7_only.cfg systemd.cfg | 4 | classification: SDK_Release_Defconfigs type: ti_sdk_dra7x_release defconfig: multi_v7_defconfig config_file: None extra_configs: multi_v7_prune.cfg baseport.cfg ipc.cfg connectivity.cfg audio_display.cfg wlan.cfg omap_soc.cfg lpae.cfg dra7_only.cfg systemd.cfg auto.cfg |
5 | classification: SDK_Release_Defconfigs type: ti_sdk_omap2_release defconfig: multi_v7_defconfig config_file: None extra_configs: multi_v7_prune.cfg baseport.cfg ipc.cfg connectivity.cfg audio_display.cfg wlan.cfg omap_soc.cfg systemd.cfg | 5 | classification: SDK_Release_Defconfigs type: ti_sdk_omap2_release defconfig: multi_v7_defconfig config_file: None extra_configs: multi_v7_prune.cfg baseport.cfg ipc.cfg connectivity.cfg audio_display.cfg wlan.cfg omap_soc.cfg systemd.cfg |
6 | classification: SDK_Release_Defconfigs type: ti_sdk_k2g_release defconfig: multi_v7_defconfig config_file: None extra_configs: multi_v7_prune.cfg baseport.cfg ipc.cfg connectivity.cfg audio_display.cfg keystone.cfg lpae.cfg k2g_only.cfg systemd.cfg | 6 | classification: SDK_Release_Defconfigs type: ti_sdk_k2g_release defconfig: multi_v7_defconfig config_file: None extra_configs: multi_v7_prune.cfg baseport.cfg ipc.cfg connectivity.cfg audio_display.cfg keystone.cfg lpae.cfg k2g_only.cfg systemd.cfg |
7 | classification: SDK_Release_Defconfigs type: ti_sdk_keystone_release defconfig: multi_v7_defconfig config_file: None extra_configs: multi_v7_prune.cfg baseport.cfg ipc.cfg connectivity.cfg audio_display.cfg keystone.cfg lpae.cfg systemd.cfg | 7 | classification: SDK_Release_Defconfigs type: ti_sdk_keystone_release defconfig: multi_v7_defconfig config_file: None extra_configs: multi_v7_prune.cfg baseport.cfg ipc.cfg connectivity.cfg audio_display.cfg keystone.cfg lpae.cfg systemd.cfg |