Commit a23086981723570c8952520d9ffaf6995d45f63e

Authored by H Hartley Sweeten
Committed by Thierry Reding
1 parent 8f43e18e27

pwm: add ep93xx PWM support

Remove the non-standard EP93xx PWM driver in drivers/misc and add
a new driver for the PWM controllers on the EP93xx platform based
on the PWM framework.

These PWM controllers each support 1 PWM channel with programmable
duty cycle, frequency, and polarity inversion.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ryan Mallon <rmallon@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>

Showing 6 changed files with 240 additions and 300 deletions Inline Diff

drivers/misc/Kconfig
1 # 1 #
2 # Misc strange devices 2 # Misc strange devices
3 # 3 #
4 4
5 menu "Misc devices" 5 menu "Misc devices"
6 6
7 config SENSORS_LIS3LV02D 7 config SENSORS_LIS3LV02D
8 tristate 8 tristate
9 depends on INPUT 9 depends on INPUT
10 select INPUT_POLLDEV 10 select INPUT_POLLDEV
11 default n 11 default n
12 12
13 config AD525X_DPOT 13 config AD525X_DPOT
14 tristate "Analog Devices Digital Potentiometers" 14 tristate "Analog Devices Digital Potentiometers"
15 depends on (I2C || SPI) && SYSFS 15 depends on (I2C || SPI) && SYSFS
16 help 16 help
17 If you say yes here, you get support for the Analog Devices 17 If you say yes here, you get support for the Analog Devices
18 AD5258, AD5259, AD5251, AD5252, AD5253, AD5254, AD5255 18 AD5258, AD5259, AD5251, AD5252, AD5253, AD5254, AD5255
19 AD5160, AD5161, AD5162, AD5165, AD5200, AD5201, AD5203, 19 AD5160, AD5161, AD5162, AD5165, AD5200, AD5201, AD5203,
20 AD5204, AD5206, AD5207, AD5231, AD5232, AD5233, AD5235, 20 AD5204, AD5206, AD5207, AD5231, AD5232, AD5233, AD5235,
21 AD5260, AD5262, AD5263, AD5290, AD5291, AD5292, AD5293, 21 AD5260, AD5262, AD5263, AD5290, AD5291, AD5292, AD5293,
22 AD7376, AD8400, AD8402, AD8403, ADN2850, AD5241, AD5242, 22 AD7376, AD8400, AD8402, AD8403, ADN2850, AD5241, AD5242,
23 AD5243, AD5245, AD5246, AD5247, AD5248, AD5280, AD5282, 23 AD5243, AD5245, AD5246, AD5247, AD5248, AD5280, AD5282,
24 ADN2860, AD5273, AD5171, AD5170, AD5172, AD5173, AD5270, 24 ADN2860, AD5273, AD5171, AD5170, AD5172, AD5173, AD5270,
25 AD5271, AD5272, AD5274 25 AD5271, AD5272, AD5274
26 digital potentiometer chips. 26 digital potentiometer chips.
27 27
28 See Documentation/misc-devices/ad525x_dpot.txt for the 28 See Documentation/misc-devices/ad525x_dpot.txt for the
29 userspace interface. 29 userspace interface.
30 30
31 This driver can also be built as a module. If so, the module 31 This driver can also be built as a module. If so, the module
32 will be called ad525x_dpot. 32 will be called ad525x_dpot.
33 33
34 config AD525X_DPOT_I2C 34 config AD525X_DPOT_I2C
35 tristate "support I2C bus connection" 35 tristate "support I2C bus connection"
36 depends on AD525X_DPOT && I2C 36 depends on AD525X_DPOT && I2C
37 help 37 help
38 Say Y here if you have a digital potentiometers hooked to an I2C bus. 38 Say Y here if you have a digital potentiometers hooked to an I2C bus.
39 39
40 To compile this driver as a module, choose M here: the 40 To compile this driver as a module, choose M here: the
41 module will be called ad525x_dpot-i2c. 41 module will be called ad525x_dpot-i2c.
42 42
43 config AD525X_DPOT_SPI 43 config AD525X_DPOT_SPI
44 tristate "support SPI bus connection" 44 tristate "support SPI bus connection"
45 depends on AD525X_DPOT && SPI_MASTER 45 depends on AD525X_DPOT && SPI_MASTER
46 help 46 help
47 Say Y here if you have a digital potentiometers hooked to an SPI bus. 47 Say Y here if you have a digital potentiometers hooked to an SPI bus.
48 48
49 If unsure, say N (but it's safe to say "Y"). 49 If unsure, say N (but it's safe to say "Y").
50 50
51 To compile this driver as a module, choose M here: the 51 To compile this driver as a module, choose M here: the
52 module will be called ad525x_dpot-spi. 52 module will be called ad525x_dpot-spi.
53 53
54 config ATMEL_PWM 54 config ATMEL_PWM
55 tristate "Atmel AT32/AT91 PWM support" 55 tristate "Atmel AT32/AT91 PWM support"
56 depends on HAVE_CLK 56 depends on HAVE_CLK
57 help 57 help
58 This option enables device driver support for the PWM channels 58 This option enables device driver support for the PWM channels
59 on certain Atmel processors. Pulse Width Modulation is used for 59 on certain Atmel processors. Pulse Width Modulation is used for
60 purposes including software controlled power-efficient backlights 60 purposes including software controlled power-efficient backlights
61 on LCD displays, motor control, and waveform generation. 61 on LCD displays, motor control, and waveform generation.
62 62
63 config ATMEL_TCLIB 63 config ATMEL_TCLIB
64 bool "Atmel AT32/AT91 Timer/Counter Library" 64 bool "Atmel AT32/AT91 Timer/Counter Library"
65 depends on (AVR32 || ARCH_AT91) 65 depends on (AVR32 || ARCH_AT91)
66 help 66 help
67 Select this if you want a library to allocate the Timer/Counter 67 Select this if you want a library to allocate the Timer/Counter
68 blocks found on many Atmel processors. This facilitates using 68 blocks found on many Atmel processors. This facilitates using
69 these blocks by different drivers despite processor differences. 69 these blocks by different drivers despite processor differences.
70 70
71 config ATMEL_TCB_CLKSRC 71 config ATMEL_TCB_CLKSRC
72 bool "TC Block Clocksource" 72 bool "TC Block Clocksource"
73 depends on ATMEL_TCLIB 73 depends on ATMEL_TCLIB
74 default y 74 default y
75 help 75 help
76 Select this to get a high precision clocksource based on a 76 Select this to get a high precision clocksource based on a
77 TC block with a 5+ MHz base clock rate. Two timer channels 77 TC block with a 5+ MHz base clock rate. Two timer channels
78 are combined to make a single 32-bit timer. 78 are combined to make a single 32-bit timer.
79 79
80 When GENERIC_CLOCKEVENTS is defined, the third timer channel 80 When GENERIC_CLOCKEVENTS is defined, the third timer channel
81 may be used as a clock event device supporting oneshot mode 81 may be used as a clock event device supporting oneshot mode
82 (delays of up to two seconds) based on the 32 KiHz clock. 82 (delays of up to two seconds) based on the 32 KiHz clock.
83 83
84 config ATMEL_TCB_CLKSRC_BLOCK 84 config ATMEL_TCB_CLKSRC_BLOCK
85 int 85 int
86 depends on ATMEL_TCB_CLKSRC 86 depends on ATMEL_TCB_CLKSRC
87 prompt "TC Block" if ARCH_AT91RM9200 || ARCH_AT91SAM9260 || CPU_AT32AP700X 87 prompt "TC Block" if ARCH_AT91RM9200 || ARCH_AT91SAM9260 || CPU_AT32AP700X
88 default 0 88 default 0
89 range 0 1 89 range 0 1
90 help 90 help
91 Some chips provide more than one TC block, so you have the 91 Some chips provide more than one TC block, so you have the
92 choice of which one to use for the clock framework. The other 92 choice of which one to use for the clock framework. The other
93 TC can be used for other purposes, such as PWM generation and 93 TC can be used for other purposes, such as PWM generation and
94 interval timing. 94 interval timing.
95 95
96 config DUMMY_IRQ 96 config DUMMY_IRQ
97 tristate "Dummy IRQ handler" 97 tristate "Dummy IRQ handler"
98 default n 98 default n
99 ---help--- 99 ---help---
100 This module accepts a single 'irq' parameter, which it should register for. 100 This module accepts a single 'irq' parameter, which it should register for.
101 The sole purpose of this module is to help with debugging of systems on 101 The sole purpose of this module is to help with debugging of systems on
102 which spurious IRQs would happen on disabled IRQ vector. 102 which spurious IRQs would happen on disabled IRQ vector.
103 103
104 config IBM_ASM 104 config IBM_ASM
105 tristate "Device driver for IBM RSA service processor" 105 tristate "Device driver for IBM RSA service processor"
106 depends on X86 && PCI && INPUT 106 depends on X86 && PCI && INPUT
107 ---help--- 107 ---help---
108 This option enables device driver support for in-band access to the 108 This option enables device driver support for in-band access to the
109 IBM RSA (Condor) service processor in eServer xSeries systems. 109 IBM RSA (Condor) service processor in eServer xSeries systems.
110 The ibmasm device driver allows user space application to access 110 The ibmasm device driver allows user space application to access
111 ASM (Advanced Systems Management) functions on the service 111 ASM (Advanced Systems Management) functions on the service
112 processor. The driver is meant to be used in conjunction with 112 processor. The driver is meant to be used in conjunction with
113 a user space API. 113 a user space API.
114 The ibmasm driver also enables the OS to use the UART on the 114 The ibmasm driver also enables the OS to use the UART on the
115 service processor board as a regular serial port. To make use of 115 service processor board as a regular serial port. To make use of
116 this feature serial driver support (CONFIG_SERIAL_8250) must be 116 this feature serial driver support (CONFIG_SERIAL_8250) must be
117 enabled. 117 enabled.
118 118
119 WARNING: This software may not be supported or function 119 WARNING: This software may not be supported or function
120 correctly on your IBM server. Please consult the IBM ServerProven 120 correctly on your IBM server. Please consult the IBM ServerProven
121 website <http://www-03.ibm.com/systems/info/x86servers/serverproven/compat/us/> 121 website <http://www-03.ibm.com/systems/info/x86servers/serverproven/compat/us/>
122 for information on the specific driver level and support statement 122 for information on the specific driver level and support statement
123 for your IBM server. 123 for your IBM server.
124 124
125 config PHANTOM 125 config PHANTOM
126 tristate "Sensable PHANToM (PCI)" 126 tristate "Sensable PHANToM (PCI)"
127 depends on PCI 127 depends on PCI
128 help 128 help
129 Say Y here if you want to build a driver for Sensable PHANToM device. 129 Say Y here if you want to build a driver for Sensable PHANToM device.
130 130
131 This driver is only for PCI PHANToMs. 131 This driver is only for PCI PHANToMs.
132 132
133 If you choose to build module, its name will be phantom. If unsure, 133 If you choose to build module, its name will be phantom. If unsure,
134 say N here. 134 say N here.
135 135
136 config INTEL_MID_PTI 136 config INTEL_MID_PTI
137 tristate "Parallel Trace Interface for MIPI P1149.7 cJTAG standard" 137 tristate "Parallel Trace Interface for MIPI P1149.7 cJTAG standard"
138 depends on PCI && TTY && (X86_INTEL_MID || COMPILE_TEST) 138 depends on PCI && TTY && (X86_INTEL_MID || COMPILE_TEST)
139 default n 139 default n
140 help 140 help
141 The PTI (Parallel Trace Interface) driver directs 141 The PTI (Parallel Trace Interface) driver directs
142 trace data routed from various parts in the system out 142 trace data routed from various parts in the system out
143 through an Intel Penwell PTI port and out of the mobile 143 through an Intel Penwell PTI port and out of the mobile
144 device for analysis with a debugging tool (Lauterbach or Fido). 144 device for analysis with a debugging tool (Lauterbach or Fido).
145 145
146 You should select this driver if the target kernel is meant for 146 You should select this driver if the target kernel is meant for
147 an Intel Atom (non-netbook) mobile device containing a MIPI 147 an Intel Atom (non-netbook) mobile device containing a MIPI
148 P1149.7 standard implementation. 148 P1149.7 standard implementation.
149 149
150 config SGI_IOC4 150 config SGI_IOC4
151 tristate "SGI IOC4 Base IO support" 151 tristate "SGI IOC4 Base IO support"
152 depends on PCI 152 depends on PCI
153 ---help--- 153 ---help---
154 This option enables basic support for the IOC4 chip on certain 154 This option enables basic support for the IOC4 chip on certain
155 SGI IO controller cards (IO9, IO10, and PCI-RT). This option 155 SGI IO controller cards (IO9, IO10, and PCI-RT). This option
156 does not enable any specific functions on such a card, but provides 156 does not enable any specific functions on such a card, but provides
157 necessary infrastructure for other drivers to utilize. 157 necessary infrastructure for other drivers to utilize.
158 158
159 If you have an SGI Altix with an IOC4-based card say Y. 159 If you have an SGI Altix with an IOC4-based card say Y.
160 Otherwise say N. 160 Otherwise say N.
161 161
162 config TIFM_CORE 162 config TIFM_CORE
163 tristate "TI Flash Media interface support" 163 tristate "TI Flash Media interface support"
164 depends on PCI 164 depends on PCI
165 help 165 help
166 If you want support for Texas Instruments(R) Flash Media adapters 166 If you want support for Texas Instruments(R) Flash Media adapters
167 you should select this option and then also choose an appropriate 167 you should select this option and then also choose an appropriate
168 host adapter, such as 'TI Flash Media PCI74xx/PCI76xx host adapter 168 host adapter, such as 'TI Flash Media PCI74xx/PCI76xx host adapter
169 support', if you have a TI PCI74xx compatible card reader, for 169 support', if you have a TI PCI74xx compatible card reader, for
170 example. 170 example.
171 You will also have to select some flash card format drivers. MMC/SD 171 You will also have to select some flash card format drivers. MMC/SD
172 cards are supported via 'MMC/SD Card support: TI Flash Media MMC/SD 172 cards are supported via 'MMC/SD Card support: TI Flash Media MMC/SD
173 Interface support (MMC_TIFM_SD)'. 173 Interface support (MMC_TIFM_SD)'.
174 174
175 To compile this driver as a module, choose M here: the module will 175 To compile this driver as a module, choose M here: the module will
176 be called tifm_core. 176 be called tifm_core.
177 177
178 config TIFM_7XX1 178 config TIFM_7XX1
179 tristate "TI Flash Media PCI74xx/PCI76xx host adapter support" 179 tristate "TI Flash Media PCI74xx/PCI76xx host adapter support"
180 depends on PCI && TIFM_CORE 180 depends on PCI && TIFM_CORE
181 default TIFM_CORE 181 default TIFM_CORE
182 help 182 help
183 This option enables support for Texas Instruments(R) PCI74xx and 183 This option enables support for Texas Instruments(R) PCI74xx and
184 PCI76xx families of Flash Media adapters, found in many laptops. 184 PCI76xx families of Flash Media adapters, found in many laptops.
185 To make actual use of the device, you will have to select some 185 To make actual use of the device, you will have to select some
186 flash card format drivers, as outlined in the TIFM_CORE Help. 186 flash card format drivers, as outlined in the TIFM_CORE Help.
187 187
188 To compile this driver as a module, choose M here: the module will 188 To compile this driver as a module, choose M here: the module will
189 be called tifm_7xx1. 189 be called tifm_7xx1.
190 190
191 config ICS932S401 191 config ICS932S401
192 tristate "Integrated Circuits ICS932S401" 192 tristate "Integrated Circuits ICS932S401"
193 depends on I2C 193 depends on I2C
194 help 194 help
195 If you say yes here you get support for the Integrated Circuits 195 If you say yes here you get support for the Integrated Circuits
196 ICS932S401 clock control chips. 196 ICS932S401 clock control chips.
197 197
198 This driver can also be built as a module. If so, the module 198 This driver can also be built as a module. If so, the module
199 will be called ics932s401. 199 will be called ics932s401.
200 200
201 config ATMEL_SSC 201 config ATMEL_SSC
202 tristate "Device driver for Atmel SSC peripheral" 202 tristate "Device driver for Atmel SSC peripheral"
203 depends on HAS_IOMEM 203 depends on HAS_IOMEM
204 ---help--- 204 ---help---
205 This option enables device driver support for Atmel Synchronized 205 This option enables device driver support for Atmel Synchronized
206 Serial Communication peripheral (SSC). 206 Serial Communication peripheral (SSC).
207 207
208 The SSC peripheral supports a wide variety of serial frame based 208 The SSC peripheral supports a wide variety of serial frame based
209 communications, i.e. I2S, SPI, etc. 209 communications, i.e. I2S, SPI, etc.
210 210
211 If unsure, say N. 211 If unsure, say N.
212 212
213 config ENCLOSURE_SERVICES 213 config ENCLOSURE_SERVICES
214 tristate "Enclosure Services" 214 tristate "Enclosure Services"
215 default n 215 default n
216 help 216 help
217 Provides support for intelligent enclosures (bays which 217 Provides support for intelligent enclosures (bays which
218 contain storage devices). You also need either a host 218 contain storage devices). You also need either a host
219 driver (SCSI/ATA) which supports enclosures 219 driver (SCSI/ATA) which supports enclosures
220 or a SCSI enclosure device (SES) to use these services. 220 or a SCSI enclosure device (SES) to use these services.
221 221
222 config SGI_XP 222 config SGI_XP
223 tristate "Support communication between SGI SSIs" 223 tristate "Support communication between SGI SSIs"
224 depends on NET 224 depends on NET
225 depends on (IA64_GENERIC || IA64_SGI_SN2 || IA64_SGI_UV || X86_UV) && SMP 225 depends on (IA64_GENERIC || IA64_SGI_SN2 || IA64_SGI_UV || X86_UV) && SMP
226 select IA64_UNCACHED_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2 226 select IA64_UNCACHED_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2
227 select GENERIC_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2 227 select GENERIC_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2
228 select SGI_GRU if X86_64 && SMP 228 select SGI_GRU if X86_64 && SMP
229 ---help--- 229 ---help---
230 An SGI machine can be divided into multiple Single System 230 An SGI machine can be divided into multiple Single System
231 Images which act independently of each other and have 231 Images which act independently of each other and have
232 hardware based memory protection from the others. Enabling 232 hardware based memory protection from the others. Enabling
233 this feature will allow for direct communication between SSIs 233 this feature will allow for direct communication between SSIs
234 based on a network adapter and DMA messaging. 234 based on a network adapter and DMA messaging.
235 235
236 config CS5535_MFGPT 236 config CS5535_MFGPT
237 tristate "CS5535/CS5536 Geode Multi-Function General Purpose Timer (MFGPT) support" 237 tristate "CS5535/CS5536 Geode Multi-Function General Purpose Timer (MFGPT) support"
238 depends on PCI && X86 && MFD_CS5535 238 depends on PCI && X86 && MFD_CS5535
239 default n 239 default n
240 help 240 help
241 This driver provides access to MFGPT functionality for other 241 This driver provides access to MFGPT functionality for other
242 drivers that need timers. MFGPTs are available in the CS5535 and 242 drivers that need timers. MFGPTs are available in the CS5535 and
243 CS5536 companion chips that are found in AMD Geode and several 243 CS5536 companion chips that are found in AMD Geode and several
244 other platforms. They have a better resolution and max interval 244 other platforms. They have a better resolution and max interval
245 than the generic PIT, and are suitable for use as high-res timers. 245 than the generic PIT, and are suitable for use as high-res timers.
246 You probably don't want to enable this manually; other drivers that 246 You probably don't want to enable this manually; other drivers that
247 make use of it should enable it. 247 make use of it should enable it.
248 248
249 config CS5535_MFGPT_DEFAULT_IRQ 249 config CS5535_MFGPT_DEFAULT_IRQ
250 int 250 int
251 depends on CS5535_MFGPT 251 depends on CS5535_MFGPT
252 default 7 252 default 7
253 help 253 help
254 MFGPTs on the CS5535 require an interrupt. The selected IRQ 254 MFGPTs on the CS5535 require an interrupt. The selected IRQ
255 can be overridden as a module option as well as by driver that 255 can be overridden as a module option as well as by driver that
256 use the cs5535_mfgpt_ API; however, different architectures might 256 use the cs5535_mfgpt_ API; however, different architectures might
257 want to use a different IRQ by default. This is here for 257 want to use a different IRQ by default. This is here for
258 architectures to set as necessary. 258 architectures to set as necessary.
259 259
260 config CS5535_CLOCK_EVENT_SRC 260 config CS5535_CLOCK_EVENT_SRC
261 tristate "CS5535/CS5536 high-res timer (MFGPT) events" 261 tristate "CS5535/CS5536 high-res timer (MFGPT) events"
262 depends on GENERIC_CLOCKEVENTS && CS5535_MFGPT 262 depends on GENERIC_CLOCKEVENTS && CS5535_MFGPT
263 help 263 help
264 This driver provides a clock event source based on the MFGPT 264 This driver provides a clock event source based on the MFGPT
265 timer(s) in the CS5535 and CS5536 companion chips. 265 timer(s) in the CS5535 and CS5536 companion chips.
266 MFGPTs have a better resolution and max interval than the 266 MFGPTs have a better resolution and max interval than the
267 generic PIT, and are suitable for use as high-res timers. 267 generic PIT, and are suitable for use as high-res timers.
268 268
269 config HP_ILO 269 config HP_ILO
270 tristate "Channel interface driver for the HP iLO processor" 270 tristate "Channel interface driver for the HP iLO processor"
271 depends on PCI 271 depends on PCI
272 default n 272 default n
273 help 273 help
274 The channel interface driver allows applications to communicate 274 The channel interface driver allows applications to communicate
275 with iLO management processors present on HP ProLiant servers. 275 with iLO management processors present on HP ProLiant servers.
276 Upon loading, the driver creates /dev/hpilo/dXccbN files, which 276 Upon loading, the driver creates /dev/hpilo/dXccbN files, which
277 can be used to gather data from the management processor, via 277 can be used to gather data from the management processor, via
278 read and write system calls. 278 read and write system calls.
279 279
280 To compile this driver as a module, choose M here: the 280 To compile this driver as a module, choose M here: the
281 module will be called hpilo. 281 module will be called hpilo.
282 282
283 config SGI_GRU 283 config SGI_GRU
284 tristate "SGI GRU driver" 284 tristate "SGI GRU driver"
285 depends on X86_UV && SMP 285 depends on X86_UV && SMP
286 default n 286 default n
287 select MMU_NOTIFIER 287 select MMU_NOTIFIER
288 ---help--- 288 ---help---
289 The GRU is a hardware resource located in the system chipset. The GRU 289 The GRU is a hardware resource located in the system chipset. The GRU
290 contains memory that can be mmapped into the user address space. This memory is 290 contains memory that can be mmapped into the user address space. This memory is
291 used to communicate with the GRU to perform functions such as load/store, 291 used to communicate with the GRU to perform functions such as load/store,
292 scatter/gather, bcopy, AMOs, etc. The GRU is directly accessed by user 292 scatter/gather, bcopy, AMOs, etc. The GRU is directly accessed by user
293 instructions using user virtual addresses. GRU instructions (ex., bcopy) use 293 instructions using user virtual addresses. GRU instructions (ex., bcopy) use
294 user virtual addresses for operands. 294 user virtual addresses for operands.
295 295
296 If you are not running on a SGI UV system, say N. 296 If you are not running on a SGI UV system, say N.
297 297
298 config SGI_GRU_DEBUG 298 config SGI_GRU_DEBUG
299 bool "SGI GRU driver debug" 299 bool "SGI GRU driver debug"
300 depends on SGI_GRU 300 depends on SGI_GRU
301 default n 301 default n
302 ---help--- 302 ---help---
303 This option enables addition debugging code for the SGI GRU driver. If 303 This option enables addition debugging code for the SGI GRU driver. If
304 you are unsure, say N. 304 you are unsure, say N.
305 305
306 config APDS9802ALS 306 config APDS9802ALS
307 tristate "Medfield Avago APDS9802 ALS Sensor module" 307 tristate "Medfield Avago APDS9802 ALS Sensor module"
308 depends on I2C 308 depends on I2C
309 help 309 help
310 If you say yes here you get support for the ALS APDS9802 ambient 310 If you say yes here you get support for the ALS APDS9802 ambient
311 light sensor. 311 light sensor.
312 312
313 This driver can also be built as a module. If so, the module 313 This driver can also be built as a module. If so, the module
314 will be called apds9802als. 314 will be called apds9802als.
315 315
316 config ISL29003 316 config ISL29003
317 tristate "Intersil ISL29003 ambient light sensor" 317 tristate "Intersil ISL29003 ambient light sensor"
318 depends on I2C && SYSFS 318 depends on I2C && SYSFS
319 help 319 help
320 If you say yes here you get support for the Intersil ISL29003 320 If you say yes here you get support for the Intersil ISL29003
321 ambient light sensor. 321 ambient light sensor.
322 322
323 This driver can also be built as a module. If so, the module 323 This driver can also be built as a module. If so, the module
324 will be called isl29003. 324 will be called isl29003.
325 325
326 config ISL29020 326 config ISL29020
327 tristate "Intersil ISL29020 ambient light sensor" 327 tristate "Intersil ISL29020 ambient light sensor"
328 depends on I2C 328 depends on I2C
329 help 329 help
330 If you say yes here you get support for the Intersil ISL29020 330 If you say yes here you get support for the Intersil ISL29020
331 ambient light sensor. 331 ambient light sensor.
332 332
333 This driver can also be built as a module. If so, the module 333 This driver can also be built as a module. If so, the module
334 will be called isl29020. 334 will be called isl29020.
335 335
336 config SENSORS_TSL2550 336 config SENSORS_TSL2550
337 tristate "Taos TSL2550 ambient light sensor" 337 tristate "Taos TSL2550 ambient light sensor"
338 depends on I2C && SYSFS 338 depends on I2C && SYSFS
339 help 339 help
340 If you say yes here you get support for the Taos TSL2550 340 If you say yes here you get support for the Taos TSL2550
341 ambient light sensor. 341 ambient light sensor.
342 342
343 This driver can also be built as a module. If so, the module 343 This driver can also be built as a module. If so, the module
344 will be called tsl2550. 344 will be called tsl2550.
345 345
346 config SENSORS_BH1780 346 config SENSORS_BH1780
347 tristate "ROHM BH1780GLI ambient light sensor" 347 tristate "ROHM BH1780GLI ambient light sensor"
348 depends on I2C && SYSFS 348 depends on I2C && SYSFS
349 help 349 help
350 If you say yes here you get support for the ROHM BH1780GLI 350 If you say yes here you get support for the ROHM BH1780GLI
351 ambient light sensor. 351 ambient light sensor.
352 352
353 This driver can also be built as a module. If so, the module 353 This driver can also be built as a module. If so, the module
354 will be called bh1780gli. 354 will be called bh1780gli.
355 355
356 config SENSORS_BH1770 356 config SENSORS_BH1770
357 tristate "BH1770GLC / SFH7770 combined ALS - Proximity sensor" 357 tristate "BH1770GLC / SFH7770 combined ALS - Proximity sensor"
358 depends on I2C 358 depends on I2C
359 ---help--- 359 ---help---
360 Say Y here if you want to build a driver for BH1770GLC (ROHM) or 360 Say Y here if you want to build a driver for BH1770GLC (ROHM) or
361 SFH7770 (Osram) combined ambient light and proximity sensor chip. 361 SFH7770 (Osram) combined ambient light and proximity sensor chip.
362 362
363 To compile this driver as a module, choose M here: the 363 To compile this driver as a module, choose M here: the
364 module will be called bh1770glc. If unsure, say N here. 364 module will be called bh1770glc. If unsure, say N here.
365 365
366 config SENSORS_APDS990X 366 config SENSORS_APDS990X
367 tristate "APDS990X combined als and proximity sensors" 367 tristate "APDS990X combined als and proximity sensors"
368 depends on I2C 368 depends on I2C
369 default n 369 default n
370 ---help--- 370 ---help---
371 Say Y here if you want to build a driver for Avago APDS990x 371 Say Y here if you want to build a driver for Avago APDS990x
372 combined ambient light and proximity sensor chip. 372 combined ambient light and proximity sensor chip.
373 373
374 To compile this driver as a module, choose M here: the 374 To compile this driver as a module, choose M here: the
375 module will be called apds990x. If unsure, say N here. 375 module will be called apds990x. If unsure, say N here.
376 376
377 config HMC6352 377 config HMC6352
378 tristate "Honeywell HMC6352 compass" 378 tristate "Honeywell HMC6352 compass"
379 depends on I2C 379 depends on I2C
380 help 380 help
381 This driver provides support for the Honeywell HMC6352 compass, 381 This driver provides support for the Honeywell HMC6352 compass,
382 providing configuration and heading data via sysfs. 382 providing configuration and heading data via sysfs.
383 383
384 config EP93XX_PWM
385 tristate "EP93xx PWM support"
386 depends on ARCH_EP93XX
387 help
388 This option enables device driver support for the PWM channels
389 on the Cirrus EP93xx processors. The EP9307 chip only has one
390 PWM channel all the others have two, the second channel is an
391 alternate function of the EGPIO14 pin. A sysfs interface is
392 provided to control the PWM channels.
393
394 To compile this driver as a module, choose M here: the module will
395 be called ep93xx_pwm.
396
397 config DS1682 384 config DS1682
398 tristate "Dallas DS1682 Total Elapsed Time Recorder with Alarm" 385 tristate "Dallas DS1682 Total Elapsed Time Recorder with Alarm"
399 depends on I2C 386 depends on I2C
400 help 387 help
401 If you say yes here you get support for Dallas Semiconductor 388 If you say yes here you get support for Dallas Semiconductor
402 DS1682 Total Elapsed Time Recorder. 389 DS1682 Total Elapsed Time Recorder.
403 390
404 This driver can also be built as a module. If so, the module 391 This driver can also be built as a module. If so, the module
405 will be called ds1682. 392 will be called ds1682.
406 393
407 config SPEAR13XX_PCIE_GADGET 394 config SPEAR13XX_PCIE_GADGET
408 bool "PCIe gadget support for SPEAr13XX platform" 395 bool "PCIe gadget support for SPEAr13XX platform"
409 depends on ARCH_SPEAR13XX && BROKEN 396 depends on ARCH_SPEAR13XX && BROKEN
410 default n 397 default n
411 help 398 help
412 This option enables gadget support for PCIe controller. If 399 This option enables gadget support for PCIe controller. If
413 board file defines any controller as PCIe endpoint then a sysfs 400 board file defines any controller as PCIe endpoint then a sysfs
414 entry will be created for that controller. User can use these 401 entry will be created for that controller. User can use these
415 sysfs node to configure PCIe EP as per his requirements. 402 sysfs node to configure PCIe EP as per his requirements.
416 403
417 config TI_DAC7512 404 config TI_DAC7512
418 tristate "Texas Instruments DAC7512" 405 tristate "Texas Instruments DAC7512"
419 depends on SPI && SYSFS 406 depends on SPI && SYSFS
420 help 407 help
421 If you say yes here you get support for the Texas Instruments 408 If you say yes here you get support for the Texas Instruments
422 DAC7512 16-bit digital-to-analog converter. 409 DAC7512 16-bit digital-to-analog converter.
423 410
424 This driver can also be built as a module. If so, the module 411 This driver can also be built as a module. If so, the module
425 will be called ti_dac7512. 412 will be called ti_dac7512.
426 413
427 config VMWARE_BALLOON 414 config VMWARE_BALLOON
428 tristate "VMware Balloon Driver" 415 tristate "VMware Balloon Driver"
429 depends on X86 && HYPERVISOR_GUEST 416 depends on X86 && HYPERVISOR_GUEST
430 help 417 help
431 This is VMware physical memory management driver which acts 418 This is VMware physical memory management driver which acts
432 like a "balloon" that can be inflated to reclaim physical pages 419 like a "balloon" that can be inflated to reclaim physical pages
433 by reserving them in the guest and invalidating them in the 420 by reserving them in the guest and invalidating them in the
434 monitor, freeing up the underlying machine pages so they can 421 monitor, freeing up the underlying machine pages so they can
435 be allocated to other guests. The balloon can also be deflated 422 be allocated to other guests. The balloon can also be deflated
436 to allow the guest to use more physical memory. 423 to allow the guest to use more physical memory.
437 424
438 If unsure, say N. 425 If unsure, say N.
439 426
440 To compile this driver as a module, choose M here: the 427 To compile this driver as a module, choose M here: the
441 module will be called vmw_balloon. 428 module will be called vmw_balloon.
442 429
443 config ARM_CHARLCD 430 config ARM_CHARLCD
444 bool "ARM Ltd. Character LCD Driver" 431 bool "ARM Ltd. Character LCD Driver"
445 depends on PLAT_VERSATILE 432 depends on PLAT_VERSATILE
446 help 433 help
447 This is a driver for the character LCD found on the ARM Ltd. 434 This is a driver for the character LCD found on the ARM Ltd.
448 Versatile and RealView Platform Baseboards. It doesn't do 435 Versatile and RealView Platform Baseboards. It doesn't do
449 very much more than display the text "ARM Linux" on the first 436 very much more than display the text "ARM Linux" on the first
450 line and the Linux version on the second line, but that's 437 line and the Linux version on the second line, but that's
451 still useful. 438 still useful.
452 439
453 config BMP085 440 config BMP085
454 bool 441 bool
455 depends on SYSFS 442 depends on SYSFS
456 443
457 config BMP085_I2C 444 config BMP085_I2C
458 tristate "BMP085 digital pressure sensor on I2C" 445 tristate "BMP085 digital pressure sensor on I2C"
459 select BMP085 446 select BMP085
460 select REGMAP_I2C 447 select REGMAP_I2C
461 depends on I2C && SYSFS 448 depends on I2C && SYSFS
462 help 449 help
463 Say Y here if you want to support Bosch Sensortec's digital pressure 450 Say Y here if you want to support Bosch Sensortec's digital pressure
464 sensor hooked to an I2C bus. 451 sensor hooked to an I2C bus.
465 452
466 To compile this driver as a module, choose M here: the 453 To compile this driver as a module, choose M here: the
467 module will be called bmp085-i2c. 454 module will be called bmp085-i2c.
468 455
469 config BMP085_SPI 456 config BMP085_SPI
470 tristate "BMP085 digital pressure sensor on SPI" 457 tristate "BMP085 digital pressure sensor on SPI"
471 select BMP085 458 select BMP085
472 select REGMAP_SPI 459 select REGMAP_SPI
473 depends on SPI_MASTER && SYSFS 460 depends on SPI_MASTER && SYSFS
474 help 461 help
475 Say Y here if you want to support Bosch Sensortec's digital pressure 462 Say Y here if you want to support Bosch Sensortec's digital pressure
476 sensor hooked to an SPI bus. 463 sensor hooked to an SPI bus.
477 464
478 To compile this driver as a module, choose M here: the 465 To compile this driver as a module, choose M here: the
479 module will be called bmp085-spi. 466 module will be called bmp085-spi.
480 467
481 config PCH_PHUB 468 config PCH_PHUB
482 tristate "Intel EG20T PCH/LAPIS Semicon IOH(ML7213/ML7223/ML7831) PHUB" 469 tristate "Intel EG20T PCH/LAPIS Semicon IOH(ML7213/ML7223/ML7831) PHUB"
483 select GENERIC_NET_UTILS 470 select GENERIC_NET_UTILS
484 depends on PCI 471 depends on PCI
485 help 472 help
486 This driver is for PCH(Platform controller Hub) PHUB(Packet Hub) of 473 This driver is for PCH(Platform controller Hub) PHUB(Packet Hub) of
487 Intel Topcliff which is an IOH(Input/Output Hub) for x86 embedded 474 Intel Topcliff which is an IOH(Input/Output Hub) for x86 embedded
488 processor. The Topcliff has MAC address and Option ROM data in SROM. 475 processor. The Topcliff has MAC address and Option ROM data in SROM.
489 This driver can access MAC address and Option ROM data in SROM. 476 This driver can access MAC address and Option ROM data in SROM.
490 477
491 This driver also can be used for LAPIS Semiconductor's IOH, 478 This driver also can be used for LAPIS Semiconductor's IOH,
492 ML7213/ML7223/ML7831. 479 ML7213/ML7223/ML7831.
493 ML7213 which is for IVI(In-Vehicle Infotainment) use. 480 ML7213 which is for IVI(In-Vehicle Infotainment) use.
494 ML7223 IOH is for MP(Media Phone) use. 481 ML7223 IOH is for MP(Media Phone) use.
495 ML7831 IOH is for general purpose use. 482 ML7831 IOH is for general purpose use.
496 ML7213/ML7223/ML7831 is companion chip for Intel Atom E6xx series. 483 ML7213/ML7223/ML7831 is companion chip for Intel Atom E6xx series.
497 ML7213/ML7223/ML7831 is completely compatible for Intel EG20T PCH. 484 ML7213/ML7223/ML7831 is completely compatible for Intel EG20T PCH.
498 485
499 To compile this driver as a module, choose M here: the module will 486 To compile this driver as a module, choose M here: the module will
500 be called pch_phub. 487 be called pch_phub.
501 488
502 config USB_SWITCH_FSA9480 489 config USB_SWITCH_FSA9480
503 tristate "FSA9480 USB Switch" 490 tristate "FSA9480 USB Switch"
504 depends on I2C 491 depends on I2C
505 help 492 help
506 The FSA9480 is a USB port accessory detector and switch. 493 The FSA9480 is a USB port accessory detector and switch.
507 The FSA9480 is fully controlled using I2C and enables USB data, 494 The FSA9480 is fully controlled using I2C and enables USB data,
508 stereo and mono audio, video, microphone and UART data to use 495 stereo and mono audio, video, microphone and UART data to use
509 a common connector port. 496 a common connector port.
510 497
511 config LATTICE_ECP3_CONFIG 498 config LATTICE_ECP3_CONFIG
512 tristate "Lattice ECP3 FPGA bitstream configuration via SPI" 499 tristate "Lattice ECP3 FPGA bitstream configuration via SPI"
513 depends on SPI && SYSFS 500 depends on SPI && SYSFS
514 select FW_LOADER 501 select FW_LOADER
515 default n 502 default n
516 help 503 help
517 This option enables support for bitstream configuration (programming 504 This option enables support for bitstream configuration (programming
518 or loading) of the Lattice ECP3 FPGA family via SPI. 505 or loading) of the Lattice ECP3 FPGA family via SPI.
519 506
520 If unsure, say N. 507 If unsure, say N.
521 508
522 config SRAM 509 config SRAM
523 bool "Generic on-chip SRAM driver" 510 bool "Generic on-chip SRAM driver"
524 depends on HAS_IOMEM 511 depends on HAS_IOMEM
525 select GENERIC_ALLOCATOR 512 select GENERIC_ALLOCATOR
526 help 513 help
527 This driver allows you to declare a memory region to be managed by 514 This driver allows you to declare a memory region to be managed by
528 the genalloc API. It is supposed to be used for small on-chip SRAM 515 the genalloc API. It is supposed to be used for small on-chip SRAM
529 areas found on many SoCs. 516 areas found on many SoCs.
530 517
531 source "drivers/misc/c2port/Kconfig" 518 source "drivers/misc/c2port/Kconfig"
532 source "drivers/misc/eeprom/Kconfig" 519 source "drivers/misc/eeprom/Kconfig"
533 source "drivers/misc/cb710/Kconfig" 520 source "drivers/misc/cb710/Kconfig"
534 source "drivers/misc/ti-st/Kconfig" 521 source "drivers/misc/ti-st/Kconfig"
535 source "drivers/misc/lis3lv02d/Kconfig" 522 source "drivers/misc/lis3lv02d/Kconfig"
536 source "drivers/misc/carma/Kconfig" 523 source "drivers/misc/carma/Kconfig"
537 source "drivers/misc/altera-stapl/Kconfig" 524 source "drivers/misc/altera-stapl/Kconfig"
538 source "drivers/misc/mei/Kconfig" 525 source "drivers/misc/mei/Kconfig"
539 source "drivers/misc/vmw_vmci/Kconfig" 526 source "drivers/misc/vmw_vmci/Kconfig"
540 endmenu 527 endmenu
541 528
drivers/misc/Makefile
1 # 1 #
2 # Makefile for misc devices that really don't fit anywhere else. 2 # Makefile for misc devices that really don't fit anywhere else.
3 # 3 #
4 4
5 obj-$(CONFIG_IBM_ASM) += ibmasm/ 5 obj-$(CONFIG_IBM_ASM) += ibmasm/
6 obj-$(CONFIG_AD525X_DPOT) += ad525x_dpot.o 6 obj-$(CONFIG_AD525X_DPOT) += ad525x_dpot.o
7 obj-$(CONFIG_AD525X_DPOT_I2C) += ad525x_dpot-i2c.o 7 obj-$(CONFIG_AD525X_DPOT_I2C) += ad525x_dpot-i2c.o
8 obj-$(CONFIG_AD525X_DPOT_SPI) += ad525x_dpot-spi.o 8 obj-$(CONFIG_AD525X_DPOT_SPI) += ad525x_dpot-spi.o
9 obj-$(CONFIG_INTEL_MID_PTI) += pti.o 9 obj-$(CONFIG_INTEL_MID_PTI) += pti.o
10 obj-$(CONFIG_ATMEL_PWM) += atmel_pwm.o 10 obj-$(CONFIG_ATMEL_PWM) += atmel_pwm.o
11 obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o 11 obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o
12 obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o 12 obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o
13 obj-$(CONFIG_BMP085) += bmp085.o 13 obj-$(CONFIG_BMP085) += bmp085.o
14 obj-$(CONFIG_BMP085_I2C) += bmp085-i2c.o 14 obj-$(CONFIG_BMP085_I2C) += bmp085-i2c.o
15 obj-$(CONFIG_BMP085_SPI) += bmp085-spi.o 15 obj-$(CONFIG_BMP085_SPI) += bmp085-spi.o
16 obj-$(CONFIG_DUMMY_IRQ) += dummy-irq.o 16 obj-$(CONFIG_DUMMY_IRQ) += dummy-irq.o
17 obj-$(CONFIG_ICS932S401) += ics932s401.o 17 obj-$(CONFIG_ICS932S401) += ics932s401.o
18 obj-$(CONFIG_LKDTM) += lkdtm.o 18 obj-$(CONFIG_LKDTM) += lkdtm.o
19 obj-$(CONFIG_TIFM_CORE) += tifm_core.o 19 obj-$(CONFIG_TIFM_CORE) += tifm_core.o
20 obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o 20 obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o
21 obj-$(CONFIG_PHANTOM) += phantom.o 21 obj-$(CONFIG_PHANTOM) += phantom.o
22 obj-$(CONFIG_SENSORS_BH1780) += bh1780gli.o 22 obj-$(CONFIG_SENSORS_BH1780) += bh1780gli.o
23 obj-$(CONFIG_SENSORS_BH1770) += bh1770glc.o 23 obj-$(CONFIG_SENSORS_BH1770) += bh1770glc.o
24 obj-$(CONFIG_SENSORS_APDS990X) += apds990x.o 24 obj-$(CONFIG_SENSORS_APDS990X) += apds990x.o
25 obj-$(CONFIG_SGI_IOC4) += ioc4.o 25 obj-$(CONFIG_SGI_IOC4) += ioc4.o
26 obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o 26 obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o
27 obj-$(CONFIG_KGDB_TESTS) += kgdbts.o 27 obj-$(CONFIG_KGDB_TESTS) += kgdbts.o
28 obj-$(CONFIG_SGI_XP) += sgi-xp/ 28 obj-$(CONFIG_SGI_XP) += sgi-xp/
29 obj-$(CONFIG_SGI_GRU) += sgi-gru/ 29 obj-$(CONFIG_SGI_GRU) += sgi-gru/
30 obj-$(CONFIG_CS5535_MFGPT) += cs5535-mfgpt.o 30 obj-$(CONFIG_CS5535_MFGPT) += cs5535-mfgpt.o
31 obj-$(CONFIG_HP_ILO) += hpilo.o 31 obj-$(CONFIG_HP_ILO) += hpilo.o
32 obj-$(CONFIG_APDS9802ALS) += apds9802als.o 32 obj-$(CONFIG_APDS9802ALS) += apds9802als.o
33 obj-$(CONFIG_ISL29003) += isl29003.o 33 obj-$(CONFIG_ISL29003) += isl29003.o
34 obj-$(CONFIG_ISL29020) += isl29020.o 34 obj-$(CONFIG_ISL29020) += isl29020.o
35 obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o 35 obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o
36 obj-$(CONFIG_EP93XX_PWM) += ep93xx_pwm.o
37 obj-$(CONFIG_DS1682) += ds1682.o 36 obj-$(CONFIG_DS1682) += ds1682.o
38 obj-$(CONFIG_TI_DAC7512) += ti_dac7512.o 37 obj-$(CONFIG_TI_DAC7512) += ti_dac7512.o
39 obj-$(CONFIG_C2PORT) += c2port/ 38 obj-$(CONFIG_C2PORT) += c2port/
40 obj-$(CONFIG_HMC6352) += hmc6352.o 39 obj-$(CONFIG_HMC6352) += hmc6352.o
41 obj-y += eeprom/ 40 obj-y += eeprom/
42 obj-y += cb710/ 41 obj-y += cb710/
43 obj-$(CONFIG_SPEAR13XX_PCIE_GADGET) += spear13xx_pcie_gadget.o 42 obj-$(CONFIG_SPEAR13XX_PCIE_GADGET) += spear13xx_pcie_gadget.o
44 obj-$(CONFIG_VMWARE_BALLOON) += vmw_balloon.o 43 obj-$(CONFIG_VMWARE_BALLOON) += vmw_balloon.o
45 obj-$(CONFIG_ARM_CHARLCD) += arm-charlcd.o 44 obj-$(CONFIG_ARM_CHARLCD) += arm-charlcd.o
46 obj-$(CONFIG_PCH_PHUB) += pch_phub.o 45 obj-$(CONFIG_PCH_PHUB) += pch_phub.o
47 obj-y += ti-st/ 46 obj-y += ti-st/
48 obj-y += lis3lv02d/ 47 obj-y += lis3lv02d/
49 obj-y += carma/ 48 obj-y += carma/
50 obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o 49 obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o
51 obj-$(CONFIG_ALTERA_STAPL) +=altera-stapl/ 50 obj-$(CONFIG_ALTERA_STAPL) +=altera-stapl/
52 obj-$(CONFIG_INTEL_MEI) += mei/ 51 obj-$(CONFIG_INTEL_MEI) += mei/
53 obj-$(CONFIG_VMWARE_VMCI) += vmw_vmci/ 52 obj-$(CONFIG_VMWARE_VMCI) += vmw_vmci/
54 obj-$(CONFIG_LATTICE_ECP3_CONFIG) += lattice-ecp3-config.o 53 obj-$(CONFIG_LATTICE_ECP3_CONFIG) += lattice-ecp3-config.o
55 obj-$(CONFIG_SRAM) += sram.o 54 obj-$(CONFIG_SRAM) += sram.o
56 55
drivers/misc/ep93xx_pwm.c
1 /* File was deleted
2 * Simple PWM driver for EP93XX
3 *
4 * (c) Copyright 2009 Matthieu Crapet <mcrapet@gmail.com>
5 * (c) Copyright 2009 H Hartley Sweeten <hsweeten@visionengravers.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 *
12 * EP9307 has only one channel:
13 * - PWMOUT
14 *
15 * EP9301/02/12/15 have two channels:
16 * - PWMOUT
17 * - PWMOUT1 (alternate function for EGPIO14)
18 */
19
20 #include <linux/module.h>
21 #include <linux/platform_device.h>
22 #include <linux/slab.h>
23 #include <linux/clk.h>
24 #include <linux/err.h>
25 #include <linux/io.h>
26
27 #include <mach/platform.h>
28
29 #define EP93XX_PWMx_TERM_COUNT 0x00
30 #define EP93XX_PWMx_DUTY_CYCLE 0x04
31 #define EP93XX_PWMx_ENABLE 0x08
32 #define EP93XX_PWMx_INVERT 0x0C
33
34 #define EP93XX_PWM_MAX_COUNT 0xFFFF
35
36 struct ep93xx_pwm {
37 void __iomem *mmio_base;
38 struct clk *clk;
39 u32 duty_percent;
40 };
41
42 /*
43 * /sys/devices/platform/ep93xx-pwm.N
44 * /min_freq read-only minimum pwm output frequency
45 * /max_req read-only maximum pwm output frequency
46 * /freq read-write pwm output frequency (0 = disable output)
47 * /duty_percent read-write pwm duty cycle percent (1..99)
48 * /invert read-write invert pwm output
49 */
50
51 static ssize_t ep93xx_pwm_get_min_freq(struct device *dev,
52 struct device_attribute *attr, char *buf)
53 {
54 struct platform_device *pdev = to_platform_device(dev);
55 struct ep93xx_pwm *pwm = platform_get_drvdata(pdev);
56 unsigned long rate = clk_get_rate(pwm->clk);
57
58 return sprintf(buf, "%ld\n", rate / (EP93XX_PWM_MAX_COUNT + 1));
59 }
60
61 static ssize_t ep93xx_pwm_get_max_freq(struct device *dev,
62 struct device_attribute *attr, char *buf)
63 {
64 struct platform_device *pdev = to_platform_device(dev);
65 struct ep93xx_pwm *pwm = platform_get_drvdata(pdev);
66 unsigned long rate = clk_get_rate(pwm->clk);
67
68 return sprintf(buf, "%ld\n", rate / 2);
69 }
70
71 static ssize_t ep93xx_pwm_get_freq(struct device *dev,
72 struct device_attribute *attr, char *buf)
73 {
74 struct platform_device *pdev = to_platform_device(dev);
75 struct ep93xx_pwm *pwm = platform_get_drvdata(pdev);
76
77 if (readl(pwm->mmio_base + EP93XX_PWMx_ENABLE) & 0x1) {
78 unsigned long rate = clk_get_rate(pwm->clk);
79 u16 term = readl(pwm->mmio_base + EP93XX_PWMx_TERM_COUNT);
80
81 return sprintf(buf, "%ld\n", rate / (term + 1));
82 } else {
83 return sprintf(buf, "disabled\n");
84 }
85 }
86
87 static ssize_t ep93xx_pwm_set_freq(struct device *dev,
88 struct device_attribute *attr, const char *buf, size_t count)
89 {
90 struct platform_device *pdev = to_platform_device(dev);
91 struct ep93xx_pwm *pwm = platform_get_drvdata(pdev);
92 long val;
93 int err;
94
95 err = kstrtol(buf, 10, &val);
96 if (err)
97 return -EINVAL;
98
99 if (val == 0) {
100 writel(0x0, pwm->mmio_base + EP93XX_PWMx_ENABLE);
101 } else if (val <= (clk_get_rate(pwm->clk) / 2)) {
102 u32 term, duty;
103
104 val = (clk_get_rate(pwm->clk) / val) - 1;
105 if (val > EP93XX_PWM_MAX_COUNT)
106 val = EP93XX_PWM_MAX_COUNT;
107 if (val < 1)
108 val = 1;
109
110 term = readl(pwm->mmio_base + EP93XX_PWMx_TERM_COUNT);
111 duty = ((val + 1) * pwm->duty_percent / 100) - 1;
112
113 /* If pwm is running, order is important */
114 if (val > term) {
115 writel(val, pwm->mmio_base + EP93XX_PWMx_TERM_COUNT);
116 writel(duty, pwm->mmio_base + EP93XX_PWMx_DUTY_CYCLE);
117 } else {
118 writel(duty, pwm->mmio_base + EP93XX_PWMx_DUTY_CYCLE);
119 writel(val, pwm->mmio_base + EP93XX_PWMx_TERM_COUNT);
120 }
121
122 if (!readl(pwm->mmio_base + EP93XX_PWMx_ENABLE) & 0x1)
123 writel(0x1, pwm->mmio_base + EP93XX_PWMx_ENABLE);
124 } else {
125 return -EINVAL;
126 }
127
128 return count;
129 }
130
131 static ssize_t ep93xx_pwm_get_duty_percent(struct device *dev,
132 struct device_attribute *attr, char *buf)
133 {
134 struct platform_device *pdev = to_platform_device(dev);
135 struct ep93xx_pwm *pwm = platform_get_drvdata(pdev);
136
137 return sprintf(buf, "%d\n", pwm->duty_percent);
138 }
139
140 static ssize_t ep93xx_pwm_set_duty_percent(struct device *dev,
141 struct device_attribute *attr, const char *buf, size_t count)
142 {
143 struct platform_device *pdev = to_platform_device(dev);
144 struct ep93xx_pwm *pwm = platform_get_drvdata(pdev);
145 long val;
146 int err;
147
148 err = kstrtol(buf, 10, &val);
149 if (err)
150 return -EINVAL;
151
152 if (val > 0 && val < 100) {
153 u32 term = readl(pwm->mmio_base + EP93XX_PWMx_TERM_COUNT);
154 u32 duty = ((term + 1) * val / 100) - 1;
155
156 writel(duty, pwm->mmio_base + EP93XX_PWMx_DUTY_CYCLE);
157 pwm->duty_percent = val;
158 return count;
159 }
160
161 return -EINVAL;
162 }
163
164 static ssize_t ep93xx_pwm_get_invert(struct device *dev,
165 struct device_attribute *attr, char *buf)
166 {
167 struct platform_device *pdev = to_platform_device(dev);
168 struct ep93xx_pwm *pwm = platform_get_drvdata(pdev);
169 int inverted = readl(pwm->mmio_base + EP93XX_PWMx_INVERT) & 0x1;
170
171 return sprintf(buf, "%d\n", inverted);
172 }
173
174 static ssize_t ep93xx_pwm_set_invert(struct device *dev,
175 struct device_attribute *attr, const char *buf, size_t count)
176 {
177 struct platform_device *pdev = to_platform_device(dev);
178 struct ep93xx_pwm *pwm = platform_get_drvdata(pdev);
179 long val;
180 int err;
181
182 err = kstrtol(buf, 10, &val);
183 if (err)
184 return -EINVAL;
185
186 if (val == 0)
187 writel(0x0, pwm->mmio_base + EP93XX_PWMx_INVERT);
188 else if (val == 1)
189 writel(0x1, pwm->mmio_base + EP93XX_PWMx_INVERT);
190 else
191 return -EINVAL;
192
193 return count;
194 }
195
196 static DEVICE_ATTR(min_freq, S_IRUGO, ep93xx_pwm_get_min_freq, NULL);
197 static DEVICE_ATTR(max_freq, S_IRUGO, ep93xx_pwm_get_max_freq, NULL);
198 static DEVICE_ATTR(freq, S_IWUSR | S_IRUGO,
199 ep93xx_pwm_get_freq, ep93xx_pwm_set_freq);
200 static DEVICE_ATTR(duty_percent, S_IWUSR | S_IRUGO,
201 ep93xx_pwm_get_duty_percent, ep93xx_pwm_set_duty_percent);
202 static DEVICE_ATTR(invert, S_IWUSR | S_IRUGO,
203 ep93xx_pwm_get_invert, ep93xx_pwm_set_invert);
204
205 static struct attribute *ep93xx_pwm_attrs[] = {
206 &dev_attr_min_freq.attr,
207 &dev_attr_max_freq.attr,
208 &dev_attr_freq.attr,
209 &dev_attr_duty_percent.attr,
210 &dev_attr_invert.attr,
211 NULL
212 };
213
214 static const struct attribute_group ep93xx_pwm_sysfs_files = {
215 .attrs = ep93xx_pwm_attrs,
216 };
217
218 static int ep93xx_pwm_probe(struct platform_device *pdev)
219 {
220 struct ep93xx_pwm *pwm;
221 struct resource *res;
222 int ret;
223
224 pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
225 if (!pwm)
226 return -ENOMEM;
227
228 pwm->clk = devm_clk_get(&pdev->dev, "pwm_clk");
229 if (IS_ERR(pwm->clk))
230 return PTR_ERR(pwm->clk);
231
232 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
233 pwm->mmio_base = devm_ioremap_resource(&pdev->dev, res);
234 if (IS_ERR(pwm->mmio_base))
235 return PTR_ERR(pwm->mmio_base);
236
237 ret = ep93xx_pwm_acquire_gpio(pdev);
238 if (ret)
239 return ret;
240
241 ret = sysfs_create_group(&pdev->dev.kobj, &ep93xx_pwm_sysfs_files);
242 if (ret) {
243 ep93xx_pwm_release_gpio(pdev);
244 return ret;
245 }
246
247 pwm->duty_percent = 50;
248
249 /* disable pwm at startup. Avoids zero value. */
250 writel(0x0, pwm->mmio_base + EP93XX_PWMx_ENABLE);
251 writel(EP93XX_PWM_MAX_COUNT, pwm->mmio_base + EP93XX_PWMx_TERM_COUNT);
252 writel(EP93XX_PWM_MAX_COUNT/2, pwm->mmio_base + EP93XX_PWMx_DUTY_CYCLE);
253
254 clk_enable(pwm->clk);
255
256 platform_set_drvdata(pdev, pwm);
257 return 0;
258 }
259
260 static int ep93xx_pwm_remove(struct platform_device *pdev)
261 {
262 struct ep93xx_pwm *pwm = platform_get_drvdata(pdev);
263
264 writel(0x0, pwm->mmio_base + EP93XX_PWMx_ENABLE);
265 clk_disable(pwm->clk);
266 sysfs_remove_group(&pdev->dev.kobj, &ep93xx_pwm_sysfs_files);
267 ep93xx_pwm_release_gpio(pdev);
268
269 return 0;
270 }
271
272 static struct platform_driver ep93xx_pwm_driver = {
273 .driver = {
274 .name = "ep93xx-pwm",
275 .owner = THIS_MODULE,
276 },
277 .probe = ep93xx_pwm_probe,
278 .remove = ep93xx_pwm_remove,
279 };
280 module_platform_driver(ep93xx_pwm_driver);
281
282 MODULE_AUTHOR("Matthieu Crapet <mcrapet@gmail.com>, "
283 "H Hartley Sweeten <hsweeten@visionengravers.com>");
284 MODULE_DESCRIPTION("EP93xx PWM driver");
285 MODULE_LICENSE("GPL");
286 MODULE_ALIAS("platform:ep93xx-pwm");
287 1 /*
1 menuconfig PWM 1 menuconfig PWM
2 bool "Pulse-Width Modulation (PWM) Support" 2 bool "Pulse-Width Modulation (PWM) Support"
3 help 3 help
4 Generic Pulse-Width Modulation (PWM) support. 4 Generic Pulse-Width Modulation (PWM) support.
5 5
6 In Pulse-Width Modulation, a variation of the width of pulses 6 In Pulse-Width Modulation, a variation of the width of pulses
7 in a rectangular pulse signal is used as a means to alter the 7 in a rectangular pulse signal is used as a means to alter the
8 average power of the signal. Applications include efficient 8 average power of the signal. Applications include efficient
9 power delivery and voltage regulation. In computer systems, 9 power delivery and voltage regulation. In computer systems,
10 PWMs are commonly used to control fans or the brightness of 10 PWMs are commonly used to control fans or the brightness of
11 display backlights. 11 display backlights.
12 12
13 This framework provides a generic interface to PWM devices 13 This framework provides a generic interface to PWM devices
14 within the Linux kernel. On the driver side it provides an API 14 within the Linux kernel. On the driver side it provides an API
15 to register and unregister a PWM chip, an abstraction of a PWM 15 to register and unregister a PWM chip, an abstraction of a PWM
16 controller, that supports one or more PWM devices. Client 16 controller, that supports one or more PWM devices. Client
17 drivers can request PWM devices and use the generic framework 17 drivers can request PWM devices and use the generic framework
18 to configure as well as enable and disable them. 18 to configure as well as enable and disable them.
19 19
20 This generic framework replaces the legacy PWM framework which 20 This generic framework replaces the legacy PWM framework which
21 allows only a single driver implementing the required API. Not 21 allows only a single driver implementing the required API. Not
22 all legacy implementations have been ported to the framework 22 all legacy implementations have been ported to the framework
23 yet. The framework provides an API that is backward compatible 23 yet. The framework provides an API that is backward compatible
24 with the legacy framework so that existing client drivers 24 with the legacy framework so that existing client drivers
25 continue to work as expected. 25 continue to work as expected.
26 26
27 If unsure, say no. 27 If unsure, say no.
28 28
29 if PWM 29 if PWM
30 30
31 config PWM_SYSFS 31 config PWM_SYSFS
32 bool 32 bool
33 default y if SYSFS 33 default y if SYSFS
34 34
35 config PWM_AB8500 35 config PWM_AB8500
36 tristate "AB8500 PWM support" 36 tristate "AB8500 PWM support"
37 depends on AB8500_CORE && ARCH_U8500 37 depends on AB8500_CORE && ARCH_U8500
38 help 38 help
39 Generic PWM framework driver for Analog Baseband AB8500. 39 Generic PWM framework driver for Analog Baseband AB8500.
40 40
41 To compile this driver as a module, choose M here: the module 41 To compile this driver as a module, choose M here: the module
42 will be called pwm-ab8500. 42 will be called pwm-ab8500.
43 43
44 config PWM_ATMEL_TCB 44 config PWM_ATMEL_TCB
45 tristate "Atmel TC Block PWM support" 45 tristate "Atmel TC Block PWM support"
46 depends on ATMEL_TCLIB && OF 46 depends on ATMEL_TCLIB && OF
47 help 47 help
48 Generic PWM framework driver for Atmel Timer Counter Block. 48 Generic PWM framework driver for Atmel Timer Counter Block.
49 49
50 A Timer Counter Block provides 6 PWM devices grouped by 2. 50 A Timer Counter Block provides 6 PWM devices grouped by 2.
51 Devices in a given group must have the same period. 51 Devices in a given group must have the same period.
52 52
53 To compile this driver as a module, choose M here: the module 53 To compile this driver as a module, choose M here: the module
54 will be called pwm-atmel-tcb. 54 will be called pwm-atmel-tcb.
55 55
56 config PWM_BFIN 56 config PWM_BFIN
57 tristate "Blackfin PWM support" 57 tristate "Blackfin PWM support"
58 depends on BFIN_GPTIMERS 58 depends on BFIN_GPTIMERS
59 help 59 help
60 Generic PWM framework driver for Blackfin. 60 Generic PWM framework driver for Blackfin.
61 61
62 To compile this driver as a module, choose M here: the module 62 To compile this driver as a module, choose M here: the module
63 will be called pwm-bfin. 63 will be called pwm-bfin.
64 64
65 config PWM_EP93XX
66 tristate "Cirrus Logic EP93xx PWM support"
67 depends on ARCH_EP93XX
68 help
69 Generic PWM framework driver for Cirrus Logic EP93xx.
70
71 To compile this driver as a module, choose M here: the module
72 will be called pwm-ep93xx.
73
65 config PWM_IMX 74 config PWM_IMX
66 tristate "i.MX PWM support" 75 tristate "i.MX PWM support"
67 depends on ARCH_MXC 76 depends on ARCH_MXC
68 help 77 help
69 Generic PWM framework driver for i.MX. 78 Generic PWM framework driver for i.MX.
70 79
71 To compile this driver as a module, choose M here: the module 80 To compile this driver as a module, choose M here: the module
72 will be called pwm-imx. 81 will be called pwm-imx.
73 82
74 config PWM_JZ4740 83 config PWM_JZ4740
75 tristate "Ingenic JZ4740 PWM support" 84 tristate "Ingenic JZ4740 PWM support"
76 depends on MACH_JZ4740 85 depends on MACH_JZ4740
77 help 86 help
78 Generic PWM framework driver for Ingenic JZ4740 based 87 Generic PWM framework driver for Ingenic JZ4740 based
79 machines. 88 machines.
80 89
81 To compile this driver as a module, choose M here: the module 90 To compile this driver as a module, choose M here: the module
82 will be called pwm-jz4740. 91 will be called pwm-jz4740.
83 92
84 config PWM_LPC32XX 93 config PWM_LPC32XX
85 tristate "LPC32XX PWM support" 94 tristate "LPC32XX PWM support"
86 depends on ARCH_LPC32XX 95 depends on ARCH_LPC32XX
87 help 96 help
88 Generic PWM framework driver for LPC32XX. The LPC32XX SOC has two 97 Generic PWM framework driver for LPC32XX. The LPC32XX SOC has two
89 PWM controllers. 98 PWM controllers.
90 99
91 To compile this driver as a module, choose M here: the module 100 To compile this driver as a module, choose M here: the module
92 will be called pwm-lpc32xx. 101 will be called pwm-lpc32xx.
93 102
94 config PWM_MXS 103 config PWM_MXS
95 tristate "Freescale MXS PWM support" 104 tristate "Freescale MXS PWM support"
96 depends on ARCH_MXS && OF 105 depends on ARCH_MXS && OF
97 select STMP_DEVICE 106 select STMP_DEVICE
98 help 107 help
99 Generic PWM framework driver for Freescale MXS. 108 Generic PWM framework driver for Freescale MXS.
100 109
101 To compile this driver as a module, choose M here: the module 110 To compile this driver as a module, choose M here: the module
102 will be called pwm-mxs. 111 will be called pwm-mxs.
103 112
104 config PWM_PCA9685 113 config PWM_PCA9685
105 tristate "NXP PCA9685 PWM driver" 114 tristate "NXP PCA9685 PWM driver"
106 depends on OF && REGMAP_I2C 115 depends on OF && REGMAP_I2C
107 help 116 help
108 Generic PWM framework driver for NXP PCA9685 LED controller. 117 Generic PWM framework driver for NXP PCA9685 LED controller.
109 118
110 To compile this driver as a module, choose M here: the module 119 To compile this driver as a module, choose M here: the module
111 will be called pwm-pca9685. 120 will be called pwm-pca9685.
112 121
113 config PWM_PUV3 122 config PWM_PUV3
114 tristate "PKUnity NetBook-0916 PWM support" 123 tristate "PKUnity NetBook-0916 PWM support"
115 depends on ARCH_PUV3 124 depends on ARCH_PUV3
116 help 125 help
117 Generic PWM framework driver for PKUnity NetBook-0916. 126 Generic PWM framework driver for PKUnity NetBook-0916.
118 127
119 To compile this driver as a module, choose M here: the module 128 To compile this driver as a module, choose M here: the module
120 will be called pwm-puv3. 129 will be called pwm-puv3.
121 130
122 config PWM_PXA 131 config PWM_PXA
123 tristate "PXA PWM support" 132 tristate "PXA PWM support"
124 depends on ARCH_PXA 133 depends on ARCH_PXA
125 help 134 help
126 Generic PWM framework driver for PXA. 135 Generic PWM framework driver for PXA.
127 136
128 To compile this driver as a module, choose M here: the module 137 To compile this driver as a module, choose M here: the module
129 will be called pwm-pxa. 138 will be called pwm-pxa.
130 139
131 config PWM_RENESAS_TPU 140 config PWM_RENESAS_TPU
132 tristate "Renesas TPU PWM support" 141 tristate "Renesas TPU PWM support"
133 depends on ARCH_SHMOBILE 142 depends on ARCH_SHMOBILE
134 help 143 help
135 This driver exposes the Timer Pulse Unit (TPU) PWM controller found 144 This driver exposes the Timer Pulse Unit (TPU) PWM controller found
136 in Renesas chips through the PWM API. 145 in Renesas chips through the PWM API.
137 146
138 To compile this driver as a module, choose M here: the module 147 To compile this driver as a module, choose M here: the module
139 will be called pwm-renesas-tpu. 148 will be called pwm-renesas-tpu.
140 149
141 config PWM_SAMSUNG 150 config PWM_SAMSUNG
142 tristate "Samsung PWM support" 151 tristate "Samsung PWM support"
143 depends on PLAT_SAMSUNG 152 depends on PLAT_SAMSUNG
144 help 153 help
145 Generic PWM framework driver for Samsung. 154 Generic PWM framework driver for Samsung.
146 155
147 To compile this driver as a module, choose M here: the module 156 To compile this driver as a module, choose M here: the module
148 will be called pwm-samsung. 157 will be called pwm-samsung.
149 158
150 config PWM_SPEAR 159 config PWM_SPEAR
151 tristate "STMicroelectronics SPEAr PWM support" 160 tristate "STMicroelectronics SPEAr PWM support"
152 depends on PLAT_SPEAR 161 depends on PLAT_SPEAR
153 depends on OF 162 depends on OF
154 help 163 help
155 Generic PWM framework driver for the PWM controller on ST 164 Generic PWM framework driver for the PWM controller on ST
156 SPEAr SoCs. 165 SPEAr SoCs.
157 166
158 To compile this driver as a module, choose M here: the module 167 To compile this driver as a module, choose M here: the module
159 will be called pwm-spear. 168 will be called pwm-spear.
160 169
161 config PWM_TEGRA 170 config PWM_TEGRA
162 tristate "NVIDIA Tegra PWM support" 171 tristate "NVIDIA Tegra PWM support"
163 depends on ARCH_TEGRA 172 depends on ARCH_TEGRA
164 help 173 help
165 Generic PWM framework driver for the PWFM controller found on NVIDIA 174 Generic PWM framework driver for the PWFM controller found on NVIDIA
166 Tegra SoCs. 175 Tegra SoCs.
167 176
168 To compile this driver as a module, choose M here: the module 177 To compile this driver as a module, choose M here: the module
169 will be called pwm-tegra. 178 will be called pwm-tegra.
170 179
171 config PWM_TIECAP 180 config PWM_TIECAP
172 tristate "ECAP PWM support" 181 tristate "ECAP PWM support"
173 depends on SOC_AM33XX || ARCH_DAVINCI_DA8XX 182 depends on SOC_AM33XX || ARCH_DAVINCI_DA8XX
174 help 183 help
175 PWM driver support for the ECAP APWM controller found on AM33XX 184 PWM driver support for the ECAP APWM controller found on AM33XX
176 TI SOC 185 TI SOC
177 186
178 To compile this driver as a module, choose M here: the module 187 To compile this driver as a module, choose M here: the module
179 will be called pwm-tiecap. 188 will be called pwm-tiecap.
180 189
181 config PWM_TIEHRPWM 190 config PWM_TIEHRPWM
182 tristate "EHRPWM PWM support" 191 tristate "EHRPWM PWM support"
183 depends on SOC_AM33XX || ARCH_DAVINCI_DA8XX 192 depends on SOC_AM33XX || ARCH_DAVINCI_DA8XX
184 help 193 help
185 PWM driver support for the EHRPWM controller found on AM33XX 194 PWM driver support for the EHRPWM controller found on AM33XX
186 TI SOC 195 TI SOC
187 196
188 To compile this driver as a module, choose M here: the module 197 To compile this driver as a module, choose M here: the module
189 will be called pwm-tiehrpwm. 198 will be called pwm-tiehrpwm.
190 199
191 config PWM_TIPWMSS 200 config PWM_TIPWMSS
192 bool 201 bool
193 default y if SOC_AM33XX && (PWM_TIECAP || PWM_TIEHRPWM) 202 default y if SOC_AM33XX && (PWM_TIECAP || PWM_TIEHRPWM)
194 help 203 help
195 PWM Subsystem driver support for AM33xx SOC. 204 PWM Subsystem driver support for AM33xx SOC.
196 205
197 PWM submodules require PWM config space access from submodule 206 PWM submodules require PWM config space access from submodule
198 drivers and require common parent driver support. 207 drivers and require common parent driver support.
199 208
200 config PWM_TWL 209 config PWM_TWL
201 tristate "TWL4030/6030 PWM support" 210 tristate "TWL4030/6030 PWM support"
202 depends on TWL4030_CORE 211 depends on TWL4030_CORE
203 help 212 help
204 Generic PWM framework driver for TWL4030/6030. 213 Generic PWM framework driver for TWL4030/6030.
205 214
206 To compile this driver as a module, choose M here: the module 215 To compile this driver as a module, choose M here: the module
207 will be called pwm-twl. 216 will be called pwm-twl.
208 217
209 config PWM_TWL_LED 218 config PWM_TWL_LED
210 tristate "TWL4030/6030 PWM support for LED drivers" 219 tristate "TWL4030/6030 PWM support for LED drivers"
211 depends on TWL4030_CORE 220 depends on TWL4030_CORE
212 help 221 help
213 Generic PWM framework driver for TWL4030/6030 LED terminals. 222 Generic PWM framework driver for TWL4030/6030 LED terminals.
214 223
215 To compile this driver as a module, choose M here: the module 224 To compile this driver as a module, choose M here: the module
216 will be called pwm-twl-led. 225 will be called pwm-twl-led.
217 226
218 config PWM_VT8500 227 config PWM_VT8500
219 tristate "vt8500 PWM support" 228 tristate "vt8500 PWM support"
220 depends on ARCH_VT8500 229 depends on ARCH_VT8500
221 help 230 help
222 Generic PWM framework driver for vt8500. 231 Generic PWM framework driver for vt8500.
223 232
224 To compile this driver as a module, choose M here: the module 233 To compile this driver as a module, choose M here: the module
225 will be called pwm-vt8500. 234 will be called pwm-vt8500.
226 235
227 endif 236 endif
228 237
drivers/pwm/Makefile
1 obj-$(CONFIG_PWM) += core.o 1 obj-$(CONFIG_PWM) += core.o
2 obj-$(CONFIG_PWM_SYSFS) += sysfs.o 2 obj-$(CONFIG_PWM_SYSFS) += sysfs.o
3 obj-$(CONFIG_PWM_AB8500) += pwm-ab8500.o 3 obj-$(CONFIG_PWM_AB8500) += pwm-ab8500.o
4 obj-$(CONFIG_PWM_ATMEL_TCB) += pwm-atmel-tcb.o 4 obj-$(CONFIG_PWM_ATMEL_TCB) += pwm-atmel-tcb.o
5 obj-$(CONFIG_PWM_BFIN) += pwm-bfin.o 5 obj-$(CONFIG_PWM_BFIN) += pwm-bfin.o
6 obj-$(CONFIG_PWM_EP93XX) += pwm-ep93xx.o
6 obj-$(CONFIG_PWM_IMX) += pwm-imx.o 7 obj-$(CONFIG_PWM_IMX) += pwm-imx.o
7 obj-$(CONFIG_PWM_JZ4740) += pwm-jz4740.o 8 obj-$(CONFIG_PWM_JZ4740) += pwm-jz4740.o
8 obj-$(CONFIG_PWM_LPC32XX) += pwm-lpc32xx.o 9 obj-$(CONFIG_PWM_LPC32XX) += pwm-lpc32xx.o
9 obj-$(CONFIG_PWM_MXS) += pwm-mxs.o 10 obj-$(CONFIG_PWM_MXS) += pwm-mxs.o
10 obj-$(CONFIG_PWM_PCA9685) += pwm-pca9685.o 11 obj-$(CONFIG_PWM_PCA9685) += pwm-pca9685.o
11 obj-$(CONFIG_PWM_PUV3) += pwm-puv3.o 12 obj-$(CONFIG_PWM_PUV3) += pwm-puv3.o
12 obj-$(CONFIG_PWM_PXA) += pwm-pxa.o 13 obj-$(CONFIG_PWM_PXA) += pwm-pxa.o
13 obj-$(CONFIG_PWM_RENESAS_TPU) += pwm-renesas-tpu.o 14 obj-$(CONFIG_PWM_RENESAS_TPU) += pwm-renesas-tpu.o
14 obj-$(CONFIG_PWM_SAMSUNG) += pwm-samsung.o 15 obj-$(CONFIG_PWM_SAMSUNG) += pwm-samsung.o
15 obj-$(CONFIG_PWM_SPEAR) += pwm-spear.o 16 obj-$(CONFIG_PWM_SPEAR) += pwm-spear.o
16 obj-$(CONFIG_PWM_TEGRA) += pwm-tegra.o 17 obj-$(CONFIG_PWM_TEGRA) += pwm-tegra.o
17 obj-$(CONFIG_PWM_TIECAP) += pwm-tiecap.o 18 obj-$(CONFIG_PWM_TIECAP) += pwm-tiecap.o
18 obj-$(CONFIG_PWM_TIEHRPWM) += pwm-tiehrpwm.o 19 obj-$(CONFIG_PWM_TIEHRPWM) += pwm-tiehrpwm.o
19 obj-$(CONFIG_PWM_TIPWMSS) += pwm-tipwmss.o 20 obj-$(CONFIG_PWM_TIPWMSS) += pwm-tipwmss.o
20 obj-$(CONFIG_PWM_TWL) += pwm-twl.o 21 obj-$(CONFIG_PWM_TWL) += pwm-twl.o
21 obj-$(CONFIG_PWM_TWL_LED) += pwm-twl-led.o 22 obj-$(CONFIG_PWM_TWL_LED) += pwm-twl-led.o
22 obj-$(CONFIG_PWM_VT8500) += pwm-vt8500.o 23 obj-$(CONFIG_PWM_VT8500) += pwm-vt8500.o
23 24
drivers/pwm/pwm-ep93xx.c
File was created 1 /*
2 * PWM framework driver for Cirrus Logic EP93xx
3 *
4 * Copyright (c) 2009 Matthieu Crapet <mcrapet@gmail.com>
5 * Copyright (c) 2009, 2013 H Hartley Sweeten <hsweeten@visionengravers.com>
6 *
7 * EP9301/02 have only one channel:
8 * platform device ep93xx-pwm.1 - PWMOUT1 (EGPIO14)
9 *
10 * EP9307 has only one channel:
11 * platform device ep93xx-pwm.0 - PWMOUT
12 *
13 * EP9312/15 have two channels:
14 * platform device ep93xx-pwm.0 - PWMOUT
15 * platform device ep93xx-pwm.1 - PWMOUT1 (EGPIO14)
16 *
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License
19 * as published by the Free Software Foundation; either version
20 * 2 of the License, or (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 */
27
28 #include <linux/module.h>
29 #include <linux/platform_device.h>
30 #include <linux/slab.h>
31 #include <linux/clk.h>
32 #include <linux/err.h>
33 #include <linux/io.h>
34 #include <linux/pwm.h>
35
36 #include <asm/div64.h>
37
38 #include <mach/platform.h> /* for ep93xx_pwm_{acquire,release}_gpio() */
39
40 #define EP93XX_PWMx_TERM_COUNT 0x00
41 #define EP93XX_PWMx_DUTY_CYCLE 0x04
42 #define EP93XX_PWMx_ENABLE 0x08
43 #define EP93XX_PWMx_INVERT 0x0c
44
45 struct ep93xx_pwm {
46 void __iomem *base;
47 struct clk *clk;
48 struct pwm_chip chip;
49 };
50
51 static inline struct ep93xx_pwm *to_ep93xx_pwm(struct pwm_chip *chip)
52 {
53 return container_of(chip, struct ep93xx_pwm, chip);
54 }
55
56 static int ep93xx_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
57 {
58 struct platform_device *pdev = to_platform_device(chip->dev);
59
60 return ep93xx_pwm_acquire_gpio(pdev);
61 }
62
63 static void ep93xx_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
64 {
65 struct platform_device *pdev = to_platform_device(chip->dev);
66
67 ep93xx_pwm_release_gpio(pdev);
68 }
69
70 static int ep93xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
71 int duty_ns, int period_ns)
72 {
73 struct ep93xx_pwm *ep93xx_pwm = to_ep93xx_pwm(chip);
74 void __iomem *base = ep93xx_pwm->base;
75 unsigned long long c;
76 unsigned long period_cycles;
77 unsigned long duty_cycles;
78 unsigned long term;
79 int ret = 0;
80
81 /*
82 * The clock needs to be enabled to access the PWM registers.
83 * Configuration can be changed at any time.
84 */
85 if (!test_bit(PWMF_ENABLED, &pwm->flags)) {
86 ret = clk_enable(ep93xx_pwm->clk);
87 if (ret)
88 return ret;
89 }
90
91 c = clk_get_rate(ep93xx_pwm->clk);
92 c *= period_ns;
93 do_div(c, 1000000000);
94 period_cycles = c;
95
96 c = period_cycles;
97 c *= duty_ns;
98 do_div(c, period_ns);
99 duty_cycles = c;
100
101 if (period_cycles < 0x10000 && duty_cycles < 0x10000) {
102 term = readw(base + EP93XX_PWMx_TERM_COUNT);
103
104 /* Order is important if PWM is running */
105 if (period_cycles > term) {
106 writew(period_cycles, base + EP93XX_PWMx_TERM_COUNT);
107 writew(duty_cycles, base + EP93XX_PWMx_DUTY_CYCLE);
108 } else {
109 writew(duty_cycles, base + EP93XX_PWMx_DUTY_CYCLE);
110 writew(period_cycles, base + EP93XX_PWMx_TERM_COUNT);
111 }
112 } else {
113 ret = -EINVAL;
114 }
115
116 if (!test_bit(PWMF_ENABLED, &pwm->flags))
117 clk_disable(ep93xx_pwm->clk);
118
119 return ret;
120 }
121
122 static int ep93xx_pwm_polarity(struct pwm_chip *chip, struct pwm_device *pwm,
123 enum pwm_polarity polarity)
124 {
125 struct ep93xx_pwm *ep93xx_pwm = to_ep93xx_pwm(chip);
126 int ret;
127
128 /*
129 * The clock needs to be enabled to access the PWM registers.
130 * Polarity can only be changed when the PWM is disabled.
131 */
132 ret = clk_enable(ep93xx_pwm->clk);
133 if (ret)
134 return ret;
135
136 if (polarity == PWM_POLARITY_INVERSED)
137 writew(0x1, ep93xx_pwm->base + EP93XX_PWMx_INVERT);
138 else
139 writew(0x0, ep93xx_pwm->base + EP93XX_PWMx_INVERT);
140
141 clk_disable(ep93xx_pwm->clk);
142
143 return 0;
144 }
145
146 static int ep93xx_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
147 {
148 struct ep93xx_pwm *ep93xx_pwm = to_ep93xx_pwm(chip);
149 int ret;
150
151 ret = clk_enable(ep93xx_pwm->clk);
152 if (ret)
153 return ret;
154
155 writew(0x1, ep93xx_pwm->base + EP93XX_PWMx_ENABLE);
156
157 return 0;
158 }
159
160 static void ep93xx_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
161 {
162 struct ep93xx_pwm *ep93xx_pwm = to_ep93xx_pwm(chip);
163
164 writew(0x0, ep93xx_pwm->base + EP93XX_PWMx_ENABLE);
165 clk_disable(ep93xx_pwm->clk);
166 }
167
168 static const struct pwm_ops ep93xx_pwm_ops = {
169 .request = ep93xx_pwm_request,
170 .free = ep93xx_pwm_free,
171 .config = ep93xx_pwm_config,
172 .set_polarity = ep93xx_pwm_polarity,
173 .enable = ep93xx_pwm_enable,
174 .disable = ep93xx_pwm_disable,
175 .owner = THIS_MODULE,
176 };
177
178 static int ep93xx_pwm_probe(struct platform_device *pdev)
179 {
180 struct ep93xx_pwm *ep93xx_pwm;
181 struct resource *res;
182 int ret;
183
184 ep93xx_pwm = devm_kzalloc(&pdev->dev, sizeof(*ep93xx_pwm), GFP_KERNEL);
185 if (!ep93xx_pwm)
186 return -ENOMEM;
187
188 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
189 ep93xx_pwm->base = devm_ioremap_resource(&pdev->dev, res);
190 if (IS_ERR(ep93xx_pwm->base))
191 return PTR_ERR(ep93xx_pwm->base);
192
193 ep93xx_pwm->clk = devm_clk_get(&pdev->dev, "pwm_clk");
194 if (IS_ERR(ep93xx_pwm->clk))
195 return PTR_ERR(ep93xx_pwm->clk);
196
197 ep93xx_pwm->chip.dev = &pdev->dev;
198 ep93xx_pwm->chip.ops = &ep93xx_pwm_ops;
199 ep93xx_pwm->chip.base = -1;
200 ep93xx_pwm->chip.npwm = 1;
201
202 ret = pwmchip_add(&ep93xx_pwm->chip);
203 if (ret < 0)
204 return ret;
205
206 platform_set_drvdata(pdev, ep93xx_pwm);
207 return 0;
208 }
209
210 static int ep93xx_pwm_remove(struct platform_device *pdev)
211 {
212 struct ep93xx_pwm *ep93xx_pwm = platform_get_drvdata(pdev);
213
214 return pwmchip_remove(&ep93xx_pwm->chip);
215 }
216
217 static struct platform_driver ep93xx_pwm_driver = {
218 .driver = {
219 .name = "ep93xx-pwm",
220 },
221 .probe = ep93xx_pwm_probe,
222 .remove = ep93xx_pwm_remove,
223 };
224 module_platform_driver(ep93xx_pwm_driver);
225
226 MODULE_DESCRIPTION("Cirrus Logic EP93xx PWM driver");
227 MODULE_AUTHOR("Matthieu Crapet <mcrapet@gmail.com>, "
228 "H Hartley Sweeten <hsweeten@visionengravers.com>");
229 MODULE_ALIAS("platform:ep93xx-pwm");
230 MODULE_LICENSE("GPL");
231