diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/dio.h | 2 | ||||
-rw-r--r-- | include/linux/dmaengine.h | 10 | ||||
-rw-r--r-- | include/linux/interrupt.h | 1 | ||||
-rw-r--r-- | include/linux/irq.h | 86 | ||||
-rw-r--r-- | include/linux/irqnr.h | 1 | ||||
-rw-r--r-- | include/linux/mISDNif.h | 5 | ||||
-rw-r--r-- | include/linux/mfd/pcf50633/adc.h | 72 | ||||
-rw-r--r-- | include/linux/mfd/pcf50633/core.h | 218 | ||||
-rw-r--r-- | include/linux/mfd/pcf50633/gpio.h | 52 | ||||
-rw-r--r-- | include/linux/mfd/pcf50633/mbc.h | 134 | ||||
-rw-r--r-- | include/linux/mfd/pcf50633/pmic.h | 67 | ||||
-rw-r--r-- | include/linux/smp.h | 13 | ||||
-rw-r--r-- | include/linux/topology.h | 6 |
13 files changed, 652 insertions, 15 deletions
diff --git a/include/linux/dio.h b/include/linux/dio.h index 1e65ebc2a3db..b2dd31ca1710 100644 --- a/include/linux/dio.h +++ b/include/linux/dio.h | |||
@@ -241,7 +241,7 @@ struct dio_driver { | |||
241 | 241 | ||
242 | extern int dio_find(int deviceid); | 242 | extern int dio_find(int deviceid); |
243 | extern unsigned long dio_scodetophysaddr(int scode); | 243 | extern unsigned long dio_scodetophysaddr(int scode); |
244 | extern void dio_create_sysfs_dev_files(struct dio_dev *); | 244 | extern int dio_create_sysfs_dev_files(struct dio_dev *); |
245 | 245 | ||
246 | /* New-style probing */ | 246 | /* New-style probing */ |
247 | extern int dio_register_driver(struct dio_driver *); | 247 | extern int dio_register_driver(struct dio_driver *); |
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 64dea2ab326c..c73f1e2b59b7 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
@@ -270,8 +270,18 @@ struct dma_device { | |||
270 | 270 | ||
271 | /* --- public DMA engine API --- */ | 271 | /* --- public DMA engine API --- */ |
272 | 272 | ||
273 | #ifdef CONFIG_DMA_ENGINE | ||
273 | void dmaengine_get(void); | 274 | void dmaengine_get(void); |
274 | void dmaengine_put(void); | 275 | void dmaengine_put(void); |
276 | #else | ||
277 | static inline void dmaengine_get(void) | ||
278 | { | ||
279 | } | ||
280 | static inline void dmaengine_put(void) | ||
281 | { | ||
282 | } | ||
283 | #endif | ||
284 | |||
275 | dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan, | 285 | dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan, |
276 | void *dest, void *src, size_t len); | 286 | void *dest, void *src, size_t len); |
277 | dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan, | 287 | dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan, |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 9127f6b51a39..472f11765f60 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
@@ -467,6 +467,7 @@ int show_interrupts(struct seq_file *p, void *v); | |||
467 | struct irq_desc; | 467 | struct irq_desc; |
468 | 468 | ||
469 | extern int early_irq_init(void); | 469 | extern int early_irq_init(void); |
470 | extern int arch_probe_nr_irqs(void); | ||
470 | extern int arch_early_irq_init(void); | 471 | extern int arch_early_irq_init(void); |
471 | extern int arch_init_chip_data(struct irq_desc *desc, int cpu); | 472 | extern int arch_init_chip_data(struct irq_desc *desc, int cpu); |
472 | 473 | ||
diff --git a/include/linux/irq.h b/include/linux/irq.h index f899b502f186..27a67536511e 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -182,11 +182,11 @@ struct irq_desc { | |||
182 | unsigned int irqs_unhandled; | 182 | unsigned int irqs_unhandled; |
183 | spinlock_t lock; | 183 | spinlock_t lock; |
184 | #ifdef CONFIG_SMP | 184 | #ifdef CONFIG_SMP |
185 | cpumask_t affinity; | 185 | cpumask_var_t affinity; |
186 | unsigned int cpu; | 186 | unsigned int cpu; |
187 | #endif | ||
188 | #ifdef CONFIG_GENERIC_PENDING_IRQ | 187 | #ifdef CONFIG_GENERIC_PENDING_IRQ |
189 | cpumask_t pending_mask; | 188 | cpumask_var_t pending_mask; |
189 | #endif | ||
190 | #endif | 190 | #endif |
191 | #ifdef CONFIG_PROC_FS | 191 | #ifdef CONFIG_PROC_FS |
192 | struct proc_dir_entry *dir; | 192 | struct proc_dir_entry *dir; |
@@ -422,4 +422,84 @@ extern int set_irq_msi(unsigned int irq, struct msi_desc *entry); | |||
422 | 422 | ||
423 | #endif /* !CONFIG_S390 */ | 423 | #endif /* !CONFIG_S390 */ |
424 | 424 | ||
425 | #ifdef CONFIG_SMP | ||
426 | /** | ||
427 | * init_alloc_desc_masks - allocate cpumasks for irq_desc | ||
428 | * @desc: pointer to irq_desc struct | ||
429 | * @cpu: cpu which will be handling the cpumasks | ||
430 | * @boot: true if need bootmem | ||
431 | * | ||
432 | * Allocates affinity and pending_mask cpumask if required. | ||
433 | * Returns true if successful (or not required). | ||
434 | * Side effect: affinity has all bits set, pending_mask has all bits clear. | ||
435 | */ | ||
436 | static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu, | ||
437 | bool boot) | ||
438 | { | ||
439 | int node; | ||
440 | |||
441 | if (boot) { | ||
442 | alloc_bootmem_cpumask_var(&desc->affinity); | ||
443 | cpumask_setall(desc->affinity); | ||
444 | |||
445 | #ifdef CONFIG_GENERIC_PENDING_IRQ | ||
446 | alloc_bootmem_cpumask_var(&desc->pending_mask); | ||
447 | cpumask_clear(desc->pending_mask); | ||
448 | #endif | ||
449 | return true; | ||
450 | } | ||
451 | |||
452 | node = cpu_to_node(cpu); | ||
453 | |||
454 | if (!alloc_cpumask_var_node(&desc->affinity, GFP_ATOMIC, node)) | ||
455 | return false; | ||
456 | cpumask_setall(desc->affinity); | ||
457 | |||
458 | #ifdef CONFIG_GENERIC_PENDING_IRQ | ||
459 | if (!alloc_cpumask_var_node(&desc->pending_mask, GFP_ATOMIC, node)) { | ||
460 | free_cpumask_var(desc->affinity); | ||
461 | return false; | ||
462 | } | ||
463 | cpumask_clear(desc->pending_mask); | ||
464 | #endif | ||
465 | return true; | ||
466 | } | ||
467 | |||
468 | /** | ||
469 | * init_copy_desc_masks - copy cpumasks for irq_desc | ||
470 | * @old_desc: pointer to old irq_desc struct | ||
471 | * @new_desc: pointer to new irq_desc struct | ||
472 | * | ||
473 | * Insures affinity and pending_masks are copied to new irq_desc. | ||
474 | * If !CONFIG_CPUMASKS_OFFSTACK the cpumasks are embedded in the | ||
475 | * irq_desc struct so the copy is redundant. | ||
476 | */ | ||
477 | |||
478 | static inline void init_copy_desc_masks(struct irq_desc *old_desc, | ||
479 | struct irq_desc *new_desc) | ||
480 | { | ||
481 | #ifdef CONFIG_CPUMASKS_OFFSTACK | ||
482 | cpumask_copy(new_desc->affinity, old_desc->affinity); | ||
483 | |||
484 | #ifdef CONFIG_GENERIC_PENDING_IRQ | ||
485 | cpumask_copy(new_desc->pending_mask, old_desc->pending_mask); | ||
486 | #endif | ||
487 | #endif | ||
488 | } | ||
489 | |||
490 | #else /* !CONFIG_SMP */ | ||
491 | |||
492 | static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu, | ||
493 | bool boot) | ||
494 | { | ||
495 | return true; | ||
496 | } | ||
497 | |||
498 | static inline void init_copy_desc_masks(struct irq_desc *old_desc, | ||
499 | struct irq_desc *new_desc) | ||
500 | { | ||
501 | } | ||
502 | |||
503 | #endif /* CONFIG_SMP */ | ||
504 | |||
425 | #endif /* _LINUX_IRQ_H */ | 505 | #endif /* _LINUX_IRQ_H */ |
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h index 86af92e9e84c..887477bc2ab0 100644 --- a/include/linux/irqnr.h +++ b/include/linux/irqnr.h | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | # define for_each_irq_desc_reverse(irq, desc) \ | 21 | # define for_each_irq_desc_reverse(irq, desc) \ |
22 | for (irq = nr_irqs - 1; irq >= 0; irq--) | 22 | for (irq = nr_irqs - 1; irq >= 0; irq--) |
23 | |||
23 | #else /* CONFIG_GENERIC_HARDIRQS */ | 24 | #else /* CONFIG_GENERIC_HARDIRQS */ |
24 | 25 | ||
25 | extern int nr_irqs; | 26 | extern int nr_irqs; |
diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h index 557477ac3d5b..5da3d95b27f1 100644 --- a/include/linux/mISDNif.h +++ b/include/linux/mISDNif.h | |||
@@ -559,7 +559,10 @@ extern void mISDN_unregister_clock(struct mISDNclock *); | |||
559 | 559 | ||
560 | static inline struct mISDNdevice *dev_to_mISDN(struct device *dev) | 560 | static inline struct mISDNdevice *dev_to_mISDN(struct device *dev) |
561 | { | 561 | { |
562 | return dev_get_drvdata(dev); | 562 | if (dev) |
563 | return dev_get_drvdata(dev); | ||
564 | else | ||
565 | return NULL; | ||
563 | } | 566 | } |
564 | 567 | ||
565 | extern void set_channel_address(struct mISDNchannel *, u_int, u_int); | 568 | extern void set_channel_address(struct mISDNchannel *, u_int, u_int); |
diff --git a/include/linux/mfd/pcf50633/adc.h b/include/linux/mfd/pcf50633/adc.h new file mode 100644 index 000000000000..56669b4183ad --- /dev/null +++ b/include/linux/mfd/pcf50633/adc.h | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | * adc.h -- Driver for NXP PCF50633 ADC | ||
3 | * | ||
4 | * (C) 2006-2008 by Openmoko, Inc. | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_MFD_PCF50633_ADC_H | ||
14 | #define __LINUX_MFD_PCF50633_ADC_H | ||
15 | |||
16 | #include <linux/mfd/pcf50633/core.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | |||
19 | /* ADC Registers */ | ||
20 | #define PCF50633_REG_ADCC3 0x52 | ||
21 | #define PCF50633_REG_ADCC2 0x53 | ||
22 | #define PCF50633_REG_ADCC1 0x54 | ||
23 | #define PCF50633_REG_ADCS1 0x55 | ||
24 | #define PCF50633_REG_ADCS2 0x56 | ||
25 | #define PCF50633_REG_ADCS3 0x57 | ||
26 | |||
27 | #define PCF50633_ADCC1_ADCSTART 0x01 | ||
28 | #define PCF50633_ADCC1_RES_10BIT 0x02 | ||
29 | #define PCF50633_ADCC1_AVERAGE_NO 0x00 | ||
30 | #define PCF50633_ADCC1_AVERAGE_4 0x04 | ||
31 | #define PCF50633_ADCC1_AVERAGE_8 0x08 | ||
32 | #define PCF50633_ADCC1_AVERAGE_16 0x0c | ||
33 | #define PCF50633_ADCC1_MUX_BATSNS_RES 0x00 | ||
34 | #define PCF50633_ADCC1_MUX_BATSNS_SUBTR 0x10 | ||
35 | #define PCF50633_ADCC1_MUX_ADCIN2_RES 0x20 | ||
36 | #define PCF50633_ADCC1_MUX_ADCIN2_SUBTR 0x30 | ||
37 | #define PCF50633_ADCC1_MUX_BATTEMP 0x60 | ||
38 | #define PCF50633_ADCC1_MUX_ADCIN1 0x70 | ||
39 | #define PCF50633_ADCC1_AVERAGE_MASK 0x0c | ||
40 | #define PCF50633_ADCC1_ADCMUX_MASK 0xf0 | ||
41 | |||
42 | #define PCF50633_ADCC2_RATIO_NONE 0x00 | ||
43 | #define PCF50633_ADCC2_RATIO_BATTEMP 0x01 | ||
44 | #define PCF50633_ADCC2_RATIO_ADCIN1 0x02 | ||
45 | #define PCF50633_ADCC2_RATIO_BOTH 0x03 | ||
46 | #define PCF50633_ADCC2_RATIOSETTL_100US 0x04 | ||
47 | |||
48 | #define PCF50633_ADCC3_ACCSW_EN 0x01 | ||
49 | #define PCF50633_ADCC3_NTCSW_EN 0x04 | ||
50 | #define PCF50633_ADCC3_RES_DIV_TWO 0x10 | ||
51 | #define PCF50633_ADCC3_RES_DIV_THREE 0x00 | ||
52 | |||
53 | #define PCF50633_ADCS3_REF_NTCSW 0x00 | ||
54 | #define PCF50633_ADCS3_REF_ACCSW 0x10 | ||
55 | #define PCF50633_ADCS3_REF_2V0 0x20 | ||
56 | #define PCF50633_ADCS3_REF_VISA 0x30 | ||
57 | #define PCF50633_ADCS3_REF_2V0_2 0x70 | ||
58 | #define PCF50633_ADCS3_ADCRDY 0x80 | ||
59 | |||
60 | #define PCF50633_ADCS3_ADCDAT1L_MASK 0x03 | ||
61 | #define PCF50633_ADCS3_ADCDAT2L_MASK 0x0c | ||
62 | #define PCF50633_ADCS3_ADCDAT2L_SHIFT 2 | ||
63 | #define PCF50633_ASCS3_REF_MASK 0x70 | ||
64 | |||
65 | extern int | ||
66 | pcf50633_adc_async_read(struct pcf50633 *pcf, int mux, int avg, | ||
67 | void (*callback)(struct pcf50633 *, void *, int), | ||
68 | void *callback_param); | ||
69 | extern int | ||
70 | pcf50633_adc_sync_read(struct pcf50633 *pcf, int mux, int avg); | ||
71 | |||
72 | #endif /* __LINUX_PCF50633_ADC_H */ | ||
diff --git a/include/linux/mfd/pcf50633/core.h b/include/linux/mfd/pcf50633/core.h new file mode 100644 index 000000000000..4455b212d75a --- /dev/null +++ b/include/linux/mfd/pcf50633/core.h | |||
@@ -0,0 +1,218 @@ | |||
1 | /* | ||
2 | * core.h -- Core driver for NXP PCF50633 | ||
3 | * | ||
4 | * (C) 2006-2008 by Openmoko, Inc. | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_MFD_PCF50633_CORE_H | ||
14 | #define __LINUX_MFD_PCF50633_CORE_H | ||
15 | |||
16 | #include <linux/i2c.h> | ||
17 | #include <linux/workqueue.h> | ||
18 | #include <linux/regulator/driver.h> | ||
19 | #include <linux/regulator/machine.h> | ||
20 | #include <linux/power_supply.h> | ||
21 | |||
22 | struct pcf50633; | ||
23 | |||
24 | #define PCF50633_NUM_REGULATORS 11 | ||
25 | |||
26 | struct pcf50633_platform_data { | ||
27 | struct regulator_init_data reg_init_data[PCF50633_NUM_REGULATORS]; | ||
28 | |||
29 | char **batteries; | ||
30 | int num_batteries; | ||
31 | |||
32 | /* Callbacks */ | ||
33 | void (*probe_done)(struct pcf50633 *); | ||
34 | void (*mbc_event_callback)(struct pcf50633 *, int); | ||
35 | void (*regulator_registered)(struct pcf50633 *, int); | ||
36 | void (*force_shutdown)(struct pcf50633 *); | ||
37 | |||
38 | u8 resumers[5]; | ||
39 | }; | ||
40 | |||
41 | struct pcf50633_subdev_pdata { | ||
42 | struct pcf50633 *pcf; | ||
43 | }; | ||
44 | |||
45 | struct pcf50633_irq { | ||
46 | void (*handler) (int, void *); | ||
47 | void *data; | ||
48 | }; | ||
49 | |||
50 | int pcf50633_register_irq(struct pcf50633 *pcf, int irq, | ||
51 | void (*handler) (int, void *), void *data); | ||
52 | int pcf50633_free_irq(struct pcf50633 *pcf, int irq); | ||
53 | |||
54 | int pcf50633_irq_mask(struct pcf50633 *pcf, int irq); | ||
55 | int pcf50633_irq_unmask(struct pcf50633 *pcf, int irq); | ||
56 | int pcf50633_irq_mask_get(struct pcf50633 *pcf, int irq); | ||
57 | |||
58 | int pcf50633_read_block(struct pcf50633 *, u8 reg, | ||
59 | int nr_regs, u8 *data); | ||
60 | int pcf50633_write_block(struct pcf50633 *pcf, u8 reg, | ||
61 | int nr_regs, u8 *data); | ||
62 | u8 pcf50633_reg_read(struct pcf50633 *, u8 reg); | ||
63 | int pcf50633_reg_write(struct pcf50633 *pcf, u8 reg, u8 val); | ||
64 | |||
65 | int pcf50633_reg_set_bit_mask(struct pcf50633 *pcf, u8 reg, u8 mask, u8 val); | ||
66 | int pcf50633_reg_clear_bits(struct pcf50633 *pcf, u8 reg, u8 bits); | ||
67 | |||
68 | /* Interrupt registers */ | ||
69 | |||
70 | #define PCF50633_REG_INT1 0x02 | ||
71 | #define PCF50633_REG_INT2 0x03 | ||
72 | #define PCF50633_REG_INT3 0x04 | ||
73 | #define PCF50633_REG_INT4 0x05 | ||
74 | #define PCF50633_REG_INT5 0x06 | ||
75 | |||
76 | #define PCF50633_REG_INT1M 0x07 | ||
77 | #define PCF50633_REG_INT2M 0x08 | ||
78 | #define PCF50633_REG_INT3M 0x09 | ||
79 | #define PCF50633_REG_INT4M 0x0a | ||
80 | #define PCF50633_REG_INT5M 0x0b | ||
81 | |||
82 | enum { | ||
83 | /* Chip IRQs */ | ||
84 | PCF50633_IRQ_ADPINS, | ||
85 | PCF50633_IRQ_ADPREM, | ||
86 | PCF50633_IRQ_USBINS, | ||
87 | PCF50633_IRQ_USBREM, | ||
88 | PCF50633_IRQ_RESERVED1, | ||
89 | PCF50633_IRQ_RESERVED2, | ||
90 | PCF50633_IRQ_ALARM, | ||
91 | PCF50633_IRQ_SECOND, | ||
92 | PCF50633_IRQ_ONKEYR, | ||
93 | PCF50633_IRQ_ONKEYF, | ||
94 | PCF50633_IRQ_EXTON1R, | ||
95 | PCF50633_IRQ_EXTON1F, | ||
96 | PCF50633_IRQ_EXTON2R, | ||
97 | PCF50633_IRQ_EXTON2F, | ||
98 | PCF50633_IRQ_EXTON3R, | ||
99 | PCF50633_IRQ_EXTON3F, | ||
100 | PCF50633_IRQ_BATFULL, | ||
101 | PCF50633_IRQ_CHGHALT, | ||
102 | PCF50633_IRQ_THLIMON, | ||
103 | PCF50633_IRQ_THLIMOFF, | ||
104 | PCF50633_IRQ_USBLIMON, | ||
105 | PCF50633_IRQ_USBLIMOFF, | ||
106 | PCF50633_IRQ_ADCRDY, | ||
107 | PCF50633_IRQ_ONKEY1S, | ||
108 | PCF50633_IRQ_LOWSYS, | ||
109 | PCF50633_IRQ_LOWBAT, | ||
110 | PCF50633_IRQ_HIGHTMP, | ||
111 | PCF50633_IRQ_AUTOPWRFAIL, | ||
112 | PCF50633_IRQ_DWN1PWRFAIL, | ||
113 | PCF50633_IRQ_DWN2PWRFAIL, | ||
114 | PCF50633_IRQ_LEDPWRFAIL, | ||
115 | PCF50633_IRQ_LEDOVP, | ||
116 | PCF50633_IRQ_LDO1PWRFAIL, | ||
117 | PCF50633_IRQ_LDO2PWRFAIL, | ||
118 | PCF50633_IRQ_LDO3PWRFAIL, | ||
119 | PCF50633_IRQ_LDO4PWRFAIL, | ||
120 | PCF50633_IRQ_LDO5PWRFAIL, | ||
121 | PCF50633_IRQ_LDO6PWRFAIL, | ||
122 | PCF50633_IRQ_HCLDOPWRFAIL, | ||
123 | PCF50633_IRQ_HCLDOOVL, | ||
124 | |||
125 | /* Always last */ | ||
126 | PCF50633_NUM_IRQ, | ||
127 | }; | ||
128 | |||
129 | struct pcf50633 { | ||
130 | struct device *dev; | ||
131 | struct i2c_client *i2c_client; | ||
132 | |||
133 | struct pcf50633_platform_data *pdata; | ||
134 | int irq; | ||
135 | struct pcf50633_irq irq_handler[PCF50633_NUM_IRQ]; | ||
136 | struct work_struct irq_work; | ||
137 | struct mutex lock; | ||
138 | |||
139 | u8 mask_regs[5]; | ||
140 | |||
141 | u8 suspend_irq_masks[5]; | ||
142 | u8 resume_reason[5]; | ||
143 | int is_suspended; | ||
144 | |||
145 | int onkey1s_held; | ||
146 | |||
147 | struct platform_device *rtc_pdev; | ||
148 | struct platform_device *mbc_pdev; | ||
149 | struct platform_device *adc_pdev; | ||
150 | struct platform_device *input_pdev; | ||
151 | struct platform_device *regulator_pdev[PCF50633_NUM_REGULATORS]; | ||
152 | }; | ||
153 | |||
154 | enum pcf50633_reg_int1 { | ||
155 | PCF50633_INT1_ADPINS = 0x01, /* Adapter inserted */ | ||
156 | PCF50633_INT1_ADPREM = 0x02, /* Adapter removed */ | ||
157 | PCF50633_INT1_USBINS = 0x04, /* USB inserted */ | ||
158 | PCF50633_INT1_USBREM = 0x08, /* USB removed */ | ||
159 | /* reserved */ | ||
160 | PCF50633_INT1_ALARM = 0x40, /* RTC alarm time is reached */ | ||
161 | PCF50633_INT1_SECOND = 0x80, /* RTC periodic second interrupt */ | ||
162 | }; | ||
163 | |||
164 | enum pcf50633_reg_int2 { | ||
165 | PCF50633_INT2_ONKEYR = 0x01, /* ONKEY rising edge */ | ||
166 | PCF50633_INT2_ONKEYF = 0x02, /* ONKEY falling edge */ | ||
167 | PCF50633_INT2_EXTON1R = 0x04, /* EXTON1 rising edge */ | ||
168 | PCF50633_INT2_EXTON1F = 0x08, /* EXTON1 falling edge */ | ||
169 | PCF50633_INT2_EXTON2R = 0x10, /* EXTON2 rising edge */ | ||
170 | PCF50633_INT2_EXTON2F = 0x20, /* EXTON2 falling edge */ | ||
171 | PCF50633_INT2_EXTON3R = 0x40, /* EXTON3 rising edge */ | ||
172 | PCF50633_INT2_EXTON3F = 0x80, /* EXTON3 falling edge */ | ||
173 | }; | ||
174 | |||
175 | enum pcf50633_reg_int3 { | ||
176 | PCF50633_INT3_BATFULL = 0x01, /* Battery full */ | ||
177 | PCF50633_INT3_CHGHALT = 0x02, /* Charger halt */ | ||
178 | PCF50633_INT3_THLIMON = 0x04, | ||
179 | PCF50633_INT3_THLIMOFF = 0x08, | ||
180 | PCF50633_INT3_USBLIMON = 0x10, | ||
181 | PCF50633_INT3_USBLIMOFF = 0x20, | ||
182 | PCF50633_INT3_ADCRDY = 0x40, /* ADC result ready */ | ||
183 | PCF50633_INT3_ONKEY1S = 0x80, /* ONKEY pressed 1 second */ | ||
184 | }; | ||
185 | |||
186 | enum pcf50633_reg_int4 { | ||
187 | PCF50633_INT4_LOWSYS = 0x01, | ||
188 | PCF50633_INT4_LOWBAT = 0x02, | ||
189 | PCF50633_INT4_HIGHTMP = 0x04, | ||
190 | PCF50633_INT4_AUTOPWRFAIL = 0x08, | ||
191 | PCF50633_INT4_DWN1PWRFAIL = 0x10, | ||
192 | PCF50633_INT4_DWN2PWRFAIL = 0x20, | ||
193 | PCF50633_INT4_LEDPWRFAIL = 0x40, | ||
194 | PCF50633_INT4_LEDOVP = 0x80, | ||
195 | }; | ||
196 | |||
197 | enum pcf50633_reg_int5 { | ||
198 | PCF50633_INT5_LDO1PWRFAIL = 0x01, | ||
199 | PCF50633_INT5_LDO2PWRFAIL = 0x02, | ||
200 | PCF50633_INT5_LDO3PWRFAIL = 0x04, | ||
201 | PCF50633_INT5_LDO4PWRFAIL = 0x08, | ||
202 | PCF50633_INT5_LDO5PWRFAIL = 0x10, | ||
203 | PCF50633_INT5_LDO6PWRFAIL = 0x20, | ||
204 | PCF50633_INT5_HCLDOPWRFAIL = 0x40, | ||
205 | PCF50633_INT5_HCLDOOVL = 0x80, | ||
206 | }; | ||
207 | |||
208 | /* misc. registers */ | ||
209 | #define PCF50633_REG_OOCSHDWN 0x0c | ||
210 | |||
211 | /* LED registers */ | ||
212 | #define PCF50633_REG_LEDOUT 0x28 | ||
213 | #define PCF50633_REG_LEDENA 0x29 | ||
214 | #define PCF50633_REG_LEDCTL 0x2a | ||
215 | #define PCF50633_REG_LEDDIM 0x2b | ||
216 | |||
217 | #endif | ||
218 | |||
diff --git a/include/linux/mfd/pcf50633/gpio.h b/include/linux/mfd/pcf50633/gpio.h new file mode 100644 index 000000000000..a42b845efc54 --- /dev/null +++ b/include/linux/mfd/pcf50633/gpio.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * gpio.h -- GPIO driver for NXP PCF50633 | ||
3 | * | ||
4 | * (C) 2006-2008 by Openmoko, Inc. | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_MFD_PCF50633_GPIO_H | ||
14 | #define __LINUX_MFD_PCF50633_GPIO_H | ||
15 | |||
16 | #include <linux/mfd/pcf50633/core.h> | ||
17 | |||
18 | #define PCF50633_GPIO1 1 | ||
19 | #define PCF50633_GPIO2 2 | ||
20 | #define PCF50633_GPIO3 3 | ||
21 | #define PCF50633_GPO 4 | ||
22 | |||
23 | #define PCF50633_REG_GPIO1CFG 0x14 | ||
24 | #define PCF50633_REG_GPIO2CFG 0x15 | ||
25 | #define PCF50633_REG_GPIO3CFG 0x16 | ||
26 | #define PCF50633_REG_GPOCFG 0x17 | ||
27 | |||
28 | #define PCF50633_GPOCFG_GPOSEL_MASK 0x07 | ||
29 | |||
30 | enum pcf50633_reg_gpocfg { | ||
31 | PCF50633_GPOCFG_GPOSEL_0 = 0x00, | ||
32 | PCF50633_GPOCFG_GPOSEL_LED_NFET = 0x01, | ||
33 | PCF50633_GPOCFG_GPOSEL_SYSxOK = 0x02, | ||
34 | PCF50633_GPOCFG_GPOSEL_CLK32K = 0x03, | ||
35 | PCF50633_GPOCFG_GPOSEL_ADAPUSB = 0x04, | ||
36 | PCF50633_GPOCFG_GPOSEL_USBxOK = 0x05, | ||
37 | PCF50633_GPOCFG_GPOSEL_ACTPH4 = 0x06, | ||
38 | PCF50633_GPOCFG_GPOSEL_1 = 0x07, | ||
39 | PCF50633_GPOCFG_GPOSEL_INVERSE = 0x08, | ||
40 | }; | ||
41 | |||
42 | int pcf50633_gpio_set(struct pcf50633 *pcf, int gpio, u8 val); | ||
43 | u8 pcf50633_gpio_get(struct pcf50633 *pcf, int gpio); | ||
44 | |||
45 | int pcf50633_gpio_invert_set(struct pcf50633 *, int gpio, int invert); | ||
46 | int pcf50633_gpio_invert_get(struct pcf50633 *pcf, int gpio); | ||
47 | |||
48 | int pcf50633_gpio_power_supply_set(struct pcf50633 *, | ||
49 | int gpio, int regulator, int on); | ||
50 | #endif /* __LINUX_MFD_PCF50633_GPIO_H */ | ||
51 | |||
52 | |||
diff --git a/include/linux/mfd/pcf50633/mbc.h b/include/linux/mfd/pcf50633/mbc.h new file mode 100644 index 000000000000..6e17619b773a --- /dev/null +++ b/include/linux/mfd/pcf50633/mbc.h | |||
@@ -0,0 +1,134 @@ | |||
1 | /* | ||
2 | * mbc.h -- Driver for NXP PCF50633 Main Battery Charger | ||
3 | * | ||
4 | * (C) 2006-2008 by Openmoko, Inc. | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_MFD_PCF50633_MBC_H | ||
14 | #define __LINUX_MFD_PCF50633_MBC_H | ||
15 | |||
16 | #include <linux/mfd/pcf50633/core.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | |||
19 | #define PCF50633_REG_MBCC1 0x43 | ||
20 | #define PCF50633_REG_MBCC2 0x44 | ||
21 | #define PCF50633_REG_MBCC3 0x45 | ||
22 | #define PCF50633_REG_MBCC4 0x46 | ||
23 | #define PCF50633_REG_MBCC5 0x47 | ||
24 | #define PCF50633_REG_MBCC6 0x48 | ||
25 | #define PCF50633_REG_MBCC7 0x49 | ||
26 | #define PCF50633_REG_MBCC8 0x4a | ||
27 | #define PCF50633_REG_MBCS1 0x4b | ||
28 | #define PCF50633_REG_MBCS2 0x4c | ||
29 | #define PCF50633_REG_MBCS3 0x4d | ||
30 | |||
31 | enum pcf50633_reg_mbcc1 { | ||
32 | PCF50633_MBCC1_CHGENA = 0x01, /* Charger enable */ | ||
33 | PCF50633_MBCC1_AUTOSTOP = 0x02, | ||
34 | PCF50633_MBCC1_AUTORES = 0x04, /* automatic resume */ | ||
35 | PCF50633_MBCC1_RESUME = 0x08, /* explicit resume cmd */ | ||
36 | PCF50633_MBCC1_RESTART = 0x10, /* restart charging */ | ||
37 | PCF50633_MBCC1_PREWDTIME_60M = 0x20, /* max. precharging time */ | ||
38 | PCF50633_MBCC1_WDTIME_1H = 0x00, | ||
39 | PCF50633_MBCC1_WDTIME_2H = 0x40, | ||
40 | PCF50633_MBCC1_WDTIME_4H = 0x80, | ||
41 | PCF50633_MBCC1_WDTIME_6H = 0xc0, | ||
42 | }; | ||
43 | #define PCF50633_MBCC1_WDTIME_MASK 0xc0 | ||
44 | |||
45 | enum pcf50633_reg_mbcc2 { | ||
46 | PCF50633_MBCC2_VBATCOND_2V7 = 0x00, | ||
47 | PCF50633_MBCC2_VBATCOND_2V85 = 0x01, | ||
48 | PCF50633_MBCC2_VBATCOND_3V0 = 0x02, | ||
49 | PCF50633_MBCC2_VBATCOND_3V15 = 0x03, | ||
50 | PCF50633_MBCC2_VMAX_4V = 0x00, | ||
51 | PCF50633_MBCC2_VMAX_4V20 = 0x28, | ||
52 | PCF50633_MBCC2_VRESDEBTIME_64S = 0x80, /* debounce time (32/64sec) */ | ||
53 | }; | ||
54 | |||
55 | enum pcf50633_reg_mbcc7 { | ||
56 | PCF50633_MBCC7_USB_100mA = 0x00, | ||
57 | PCF50633_MBCC7_USB_500mA = 0x01, | ||
58 | PCF50633_MBCC7_USB_1000mA = 0x02, | ||
59 | PCF50633_MBCC7_USB_SUSPEND = 0x03, | ||
60 | PCF50633_MBCC7_BATTEMP_EN = 0x04, | ||
61 | PCF50633_MBCC7_BATSYSIMAX_1A6 = 0x00, | ||
62 | PCF50633_MBCC7_BATSYSIMAX_1A8 = 0x40, | ||
63 | PCF50633_MBCC7_BATSYSIMAX_2A0 = 0x80, | ||
64 | PCF50633_MBCC7_BATSYSIMAX_2A2 = 0xc0, | ||
65 | }; | ||
66 | #define PCF50633_MBCC7_USB_MASK 0x03 | ||
67 | |||
68 | enum pcf50633_reg_mbcc8 { | ||
69 | PCF50633_MBCC8_USBENASUS = 0x10, | ||
70 | }; | ||
71 | |||
72 | enum pcf50633_reg_mbcs1 { | ||
73 | PCF50633_MBCS1_USBPRES = 0x01, | ||
74 | PCF50633_MBCS1_USBOK = 0x02, | ||
75 | PCF50633_MBCS1_ADAPTPRES = 0x04, | ||
76 | PCF50633_MBCS1_ADAPTOK = 0x08, | ||
77 | PCF50633_MBCS1_TBAT_OK = 0x00, | ||
78 | PCF50633_MBCS1_TBAT_ABOVE = 0x10, | ||
79 | PCF50633_MBCS1_TBAT_BELOW = 0x20, | ||
80 | PCF50633_MBCS1_TBAT_UNDEF = 0x30, | ||
81 | PCF50633_MBCS1_PREWDTEXP = 0x40, | ||
82 | PCF50633_MBCS1_WDTEXP = 0x80, | ||
83 | }; | ||
84 | |||
85 | enum pcf50633_reg_mbcs2_mbcmod { | ||
86 | PCF50633_MBCS2_MBC_PLAY = 0x00, | ||
87 | PCF50633_MBCS2_MBC_USB_PRE = 0x01, | ||
88 | PCF50633_MBCS2_MBC_USB_PRE_WAIT = 0x02, | ||
89 | PCF50633_MBCS2_MBC_USB_FAST = 0x03, | ||
90 | PCF50633_MBCS2_MBC_USB_FAST_WAIT = 0x04, | ||
91 | PCF50633_MBCS2_MBC_USB_SUSPEND = 0x05, | ||
92 | PCF50633_MBCS2_MBC_ADP_PRE = 0x06, | ||
93 | PCF50633_MBCS2_MBC_ADP_PRE_WAIT = 0x07, | ||
94 | PCF50633_MBCS2_MBC_ADP_FAST = 0x08, | ||
95 | PCF50633_MBCS2_MBC_ADP_FAST_WAIT = 0x09, | ||
96 | PCF50633_MBCS2_MBC_BAT_FULL = 0x0a, | ||
97 | PCF50633_MBCS2_MBC_HALT = 0x0b, | ||
98 | }; | ||
99 | #define PCF50633_MBCS2_MBC_MASK 0x0f | ||
100 | enum pcf50633_reg_mbcs2_chgstat { | ||
101 | PCF50633_MBCS2_CHGS_NONE = 0x00, | ||
102 | PCF50633_MBCS2_CHGS_ADAPTER = 0x10, | ||
103 | PCF50633_MBCS2_CHGS_USB = 0x20, | ||
104 | PCF50633_MBCS2_CHGS_BOTH = 0x30, | ||
105 | }; | ||
106 | #define PCF50633_MBCS2_RESSTAT_AUTO 0x40 | ||
107 | |||
108 | enum pcf50633_reg_mbcs3 { | ||
109 | PCF50633_MBCS3_USBLIM_PLAY = 0x01, | ||
110 | PCF50633_MBCS3_USBLIM_CGH = 0x02, | ||
111 | PCF50633_MBCS3_TLIM_PLAY = 0x04, | ||
112 | PCF50633_MBCS3_TLIM_CHG = 0x08, | ||
113 | PCF50633_MBCS3_ILIM = 0x10, /* 1: Ibat > Icutoff */ | ||
114 | PCF50633_MBCS3_VLIM = 0x20, /* 1: Vbat == Vmax */ | ||
115 | PCF50633_MBCS3_VBATSTAT = 0x40, /* 1: Vbat > Vbatcond */ | ||
116 | PCF50633_MBCS3_VRES = 0x80, /* 1: Vbat > Vth(RES) */ | ||
117 | }; | ||
118 | |||
119 | #define PCF50633_MBCC2_VBATCOND_MASK 0x03 | ||
120 | #define PCF50633_MBCC2_VMAX_MASK 0x3c | ||
121 | |||
122 | /* Charger status */ | ||
123 | #define PCF50633_MBC_USB_ONLINE 0x01 | ||
124 | #define PCF50633_MBC_USB_ACTIVE 0x02 | ||
125 | #define PCF50633_MBC_ADAPTER_ONLINE 0x04 | ||
126 | #define PCF50633_MBC_ADAPTER_ACTIVE 0x08 | ||
127 | |||
128 | int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma); | ||
129 | |||
130 | int pcf50633_mbc_get_status(struct pcf50633 *); | ||
131 | void pcf50633_mbc_set_status(struct pcf50633 *, int what, int status); | ||
132 | |||
133 | #endif | ||
134 | |||
diff --git a/include/linux/mfd/pcf50633/pmic.h b/include/linux/mfd/pcf50633/pmic.h new file mode 100644 index 000000000000..2d3dbe53b235 --- /dev/null +++ b/include/linux/mfd/pcf50633/pmic.h | |||
@@ -0,0 +1,67 @@ | |||
1 | #ifndef __LINUX_MFD_PCF50633_PMIC_H | ||
2 | #define __LINUX_MFD_PCF50633_PMIC_H | ||
3 | |||
4 | #include <linux/mfd/pcf50633/core.h> | ||
5 | #include <linux/platform_device.h> | ||
6 | |||
7 | #define PCF50633_REG_AUTOOUT 0x1a | ||
8 | #define PCF50633_REG_AUTOENA 0x1b | ||
9 | #define PCF50633_REG_AUTOCTL 0x1c | ||
10 | #define PCF50633_REG_AUTOMXC 0x1d | ||
11 | #define PCF50633_REG_DOWN1OUT 0x1e | ||
12 | #define PCF50633_REG_DOWN1ENA 0x1f | ||
13 | #define PCF50633_REG_DOWN1CTL 0x20 | ||
14 | #define PCF50633_REG_DOWN1MXC 0x21 | ||
15 | #define PCF50633_REG_DOWN2OUT 0x22 | ||
16 | #define PCF50633_REG_DOWN2ENA 0x23 | ||
17 | #define PCF50633_REG_DOWN2CTL 0x24 | ||
18 | #define PCF50633_REG_DOWN2MXC 0x25 | ||
19 | #define PCF50633_REG_MEMLDOOUT 0x26 | ||
20 | #define PCF50633_REG_MEMLDOENA 0x27 | ||
21 | #define PCF50633_REG_LDO1OUT 0x2d | ||
22 | #define PCF50633_REG_LDO1ENA 0x2e | ||
23 | #define PCF50633_REG_LDO2OUT 0x2f | ||
24 | #define PCF50633_REG_LDO2ENA 0x30 | ||
25 | #define PCF50633_REG_LDO3OUT 0x31 | ||
26 | #define PCF50633_REG_LDO3ENA 0x32 | ||
27 | #define PCF50633_REG_LDO4OUT 0x33 | ||
28 | #define PCF50633_REG_LDO4ENA 0x34 | ||
29 | #define PCF50633_REG_LDO5OUT 0x35 | ||
30 | #define PCF50633_REG_LDO5ENA 0x36 | ||
31 | #define PCF50633_REG_LDO6OUT 0x37 | ||
32 | #define PCF50633_REG_LDO6ENA 0x38 | ||
33 | #define PCF50633_REG_HCLDOOUT 0x39 | ||
34 | #define PCF50633_REG_HCLDOENA 0x3a | ||
35 | #define PCF50633_REG_HCLDOOVL 0x40 | ||
36 | |||
37 | enum pcf50633_regulator_enable { | ||
38 | PCF50633_REGULATOR_ON = 0x01, | ||
39 | PCF50633_REGULATOR_ON_GPIO1 = 0x02, | ||
40 | PCF50633_REGULATOR_ON_GPIO2 = 0x04, | ||
41 | PCF50633_REGULATOR_ON_GPIO3 = 0x08, | ||
42 | }; | ||
43 | #define PCF50633_REGULATOR_ON_MASK 0x0f | ||
44 | |||
45 | enum pcf50633_regulator_phase { | ||
46 | PCF50633_REGULATOR_ACTPH1 = 0x00, | ||
47 | PCF50633_REGULATOR_ACTPH2 = 0x10, | ||
48 | PCF50633_REGULATOR_ACTPH3 = 0x20, | ||
49 | PCF50633_REGULATOR_ACTPH4 = 0x30, | ||
50 | }; | ||
51 | #define PCF50633_REGULATOR_ACTPH_MASK 0x30 | ||
52 | |||
53 | enum pcf50633_regulator_id { | ||
54 | PCF50633_REGULATOR_AUTO, | ||
55 | PCF50633_REGULATOR_DOWN1, | ||
56 | PCF50633_REGULATOR_DOWN2, | ||
57 | PCF50633_REGULATOR_LDO1, | ||
58 | PCF50633_REGULATOR_LDO2, | ||
59 | PCF50633_REGULATOR_LDO3, | ||
60 | PCF50633_REGULATOR_LDO4, | ||
61 | PCF50633_REGULATOR_LDO5, | ||
62 | PCF50633_REGULATOR_LDO6, | ||
63 | PCF50633_REGULATOR_HCLDO, | ||
64 | PCF50633_REGULATOR_MEMLDO, | ||
65 | }; | ||
66 | #endif | ||
67 | |||
diff --git a/include/linux/smp.h b/include/linux/smp.h index b82466968101..715196b09d67 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h | |||
@@ -24,6 +24,9 @@ struct call_single_data { | |||
24 | /* total number of cpus in this system (may exceed NR_CPUS) */ | 24 | /* total number of cpus in this system (may exceed NR_CPUS) */ |
25 | extern unsigned int total_cpus; | 25 | extern unsigned int total_cpus; |
26 | 26 | ||
27 | int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, | ||
28 | int wait); | ||
29 | |||
27 | #ifdef CONFIG_SMP | 30 | #ifdef CONFIG_SMP |
28 | 31 | ||
29 | #include <linux/preempt.h> | 32 | #include <linux/preempt.h> |
@@ -79,8 +82,6 @@ smp_call_function_mask(cpumask_t mask, void(*func)(void *info), void *info, | |||
79 | return 0; | 82 | return 0; |
80 | } | 83 | } |
81 | 84 | ||
82 | int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, | ||
83 | int wait); | ||
84 | void __smp_call_function_single(int cpuid, struct call_single_data *data); | 85 | void __smp_call_function_single(int cpuid, struct call_single_data *data); |
85 | 86 | ||
86 | /* | 87 | /* |
@@ -140,14 +141,6 @@ static inline int up_smp_call_function(void (*func)(void *), void *info) | |||
140 | static inline void smp_send_reschedule(int cpu) { } | 141 | static inline void smp_send_reschedule(int cpu) { } |
141 | #define num_booting_cpus() 1 | 142 | #define num_booting_cpus() 1 |
142 | #define smp_prepare_boot_cpu() do {} while (0) | 143 | #define smp_prepare_boot_cpu() do {} while (0) |
143 | #define smp_call_function_single(cpuid, func, info, wait) \ | ||
144 | ({ \ | ||
145 | WARN_ON(cpuid != 0); \ | ||
146 | local_irq_disable(); \ | ||
147 | (func)(info); \ | ||
148 | local_irq_enable(); \ | ||
149 | 0; \ | ||
150 | }) | ||
151 | #define smp_call_function_mask(mask, func, info, wait) \ | 144 | #define smp_call_function_mask(mask, func, info, wait) \ |
152 | (up_smp_call_function(func, info)) | 145 | (up_smp_call_function(func, info)) |
153 | #define smp_call_function_many(mask, func, info, wait) \ | 146 | #define smp_call_function_many(mask, func, info, wait) \ |
diff --git a/include/linux/topology.h b/include/linux/topology.h index e632d29f0544..a16b9e06f2e5 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h | |||
@@ -193,5 +193,11 @@ int arch_update_cpu_topology(void); | |||
193 | #ifndef topology_core_siblings | 193 | #ifndef topology_core_siblings |
194 | #define topology_core_siblings(cpu) cpumask_of_cpu(cpu) | 194 | #define topology_core_siblings(cpu) cpumask_of_cpu(cpu) |
195 | #endif | 195 | #endif |
196 | #ifndef topology_thread_cpumask | ||
197 | #define topology_thread_cpumask(cpu) cpumask_of(cpu) | ||
198 | #endif | ||
199 | #ifndef topology_core_cpumask | ||
200 | #define topology_core_cpumask(cpu) cpumask_of(cpu) | ||
201 | #endif | ||
196 | 202 | ||
197 | #endif /* _LINUX_TOPOLOGY_H */ | 203 | #endif /* _LINUX_TOPOLOGY_H */ |