aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r--arch/arm/plat-omap/dmtimer.c1
-rw-r--r--arch/arm/plat-omap/i2c.c2
-rw-r--r--arch/arm/plat-omap/include/plat/cpu.h17
-rw-r--r--arch/arm/plat-omap/include/plat/dmtimer.h4
-rw-r--r--arch/arm/plat-omap/include/plat/omap-alsa.h123
-rw-r--r--arch/arm/plat-omap/include/plat/omap-pm.h4
-rw-r--r--arch/arm/plat-omap/include/plat/omap_device.h2
-rw-r--r--arch/arm/plat-omap/include/plat/omap_hwmod.h2
-rw-r--r--arch/arm/plat-omap/omap-pm-noop.c24
-rw-r--r--arch/arm/plat-omap/omap_device.c3
10 files changed, 39 insertions, 143 deletions
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 2def4e1990ed..af3b92be8459 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -35,6 +35,7 @@
35 * 675 Mass Ave, Cambridge, MA 02139, USA. 35 * 675 Mass Ave, Cambridge, MA 02139, USA.
36 */ 36 */
37 37
38#include <linux/module.h>
38#include <linux/io.h> 39#include <linux/io.h>
39#include <linux/slab.h> 40#include <linux/slab.h>
40#include <linux/err.h> 41#include <linux/err.h>
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index 679cbd49c019..db071bc71c4d 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -184,7 +184,7 @@ static inline int omap2_i2c_add_bus(int bus_id)
184 NULL, 0, 0); 184 NULL, 0, 0);
185 WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name); 185 WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name);
186 186
187 return PTR_ERR(pdev); 187 return PTR_RET(pdev);
188} 188}
189#else 189#else
190static inline int omap2_i2c_add_bus(int bus_id) 190static inline int omap2_i2c_add_bus(int bus_id)
diff --git a/arch/arm/plat-omap/include/plat/cpu.h b/arch/arm/plat-omap/include/plat/cpu.h
index 2f9026942229..408a12f79205 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -399,6 +399,13 @@ void omap2_check_revision(void);
399 399
400/* 400/*
401 * Runtime detection of OMAP3 features 401 * Runtime detection of OMAP3 features
402 *
403 * OMAP3_HAS_IO_CHAIN_CTRL: Some later members of the OMAP3 chip
404 * family have OS-level control over the I/O chain clock. This is
405 * to avoid a window during which wakeups could potentially be lost
406 * during powerdomain transitions. If this bit is set, it
407 * indicates that the chip does support OS-level control of this
408 * feature.
402 */ 409 */
403extern u32 omap_features; 410extern u32 omap_features;
404 411
@@ -410,9 +417,10 @@ extern u32 omap_features;
410#define OMAP3_HAS_192MHZ_CLK BIT(5) 417#define OMAP3_HAS_192MHZ_CLK BIT(5)
411#define OMAP3_HAS_IO_WAKEUP BIT(6) 418#define OMAP3_HAS_IO_WAKEUP BIT(6)
412#define OMAP3_HAS_SDRC BIT(7) 419#define OMAP3_HAS_SDRC BIT(7)
413#define OMAP4_HAS_MPU_1GHZ BIT(8) 420#define OMAP3_HAS_IO_CHAIN_CTRL BIT(8)
414#define OMAP4_HAS_MPU_1_2GHZ BIT(9) 421#define OMAP4_HAS_MPU_1GHZ BIT(9)
415#define OMAP4_HAS_MPU_1_5GHZ BIT(10) 422#define OMAP4_HAS_MPU_1_2GHZ BIT(10)
423#define OMAP4_HAS_MPU_1_5GHZ BIT(11)
416 424
417 425
418#define OMAP3_HAS_FEATURE(feat,flag) \ 426#define OMAP3_HAS_FEATURE(feat,flag) \
@@ -429,12 +437,11 @@ OMAP3_HAS_FEATURE(isp, ISP)
429OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK) 437OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK)
430OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP) 438OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP)
431OMAP3_HAS_FEATURE(sdrc, SDRC) 439OMAP3_HAS_FEATURE(sdrc, SDRC)
440OMAP3_HAS_FEATURE(io_chain_ctrl, IO_CHAIN_CTRL)
432 441
433/* 442/*
434 * Runtime detection of OMAP4 features 443 * Runtime detection of OMAP4 features
435 */ 444 */
436extern u32 omap_features;
437
438#define OMAP4_HAS_FEATURE(feat, flag) \ 445#define OMAP4_HAS_FEATURE(feat, flag) \
439static inline unsigned int omap4_has_ ##feat(void) \ 446static inline unsigned int omap4_has_ ##feat(void) \
440{ \ 447{ \
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index d11025e6e7a4..9418f00b6c38 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -104,7 +104,7 @@ struct dmtimer_platform_data {
104 104
105 bool loses_context; 105 bool loses_context;
106 106
107 u32 (*get_context_loss_count)(struct device *dev); 107 int (*get_context_loss_count)(struct device *dev);
108}; 108};
109 109
110struct omap_dm_timer *omap_dm_timer_request(void); 110struct omap_dm_timer *omap_dm_timer_request(void);
@@ -279,7 +279,7 @@ struct omap_dm_timer {
279 struct platform_device *pdev; 279 struct platform_device *pdev;
280 struct list_head node; 280 struct list_head node;
281 281
282 u32 (*get_context_loss_count)(struct device *dev); 282 int (*get_context_loss_count)(struct device *dev);
283}; 283};
284 284
285int omap_dm_timer_prepare(struct omap_dm_timer *timer); 285int omap_dm_timer_prepare(struct omap_dm_timer *timer);
diff --git a/arch/arm/plat-omap/include/plat/omap-alsa.h b/arch/arm/plat-omap/include/plat/omap-alsa.h
deleted file mode 100644
index b53055b390d0..000000000000
--- a/arch/arm/plat-omap/include/plat/omap-alsa.h
+++ /dev/null
@@ -1,123 +0,0 @@
1/*
2 * arch/arm/plat-omap/include/mach/omap-alsa.h
3 *
4 * Alsa Driver for AIC23 and TSC2101 codecs on OMAP platform boards.
5 *
6 * Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi>
7 *
8 * Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil
9 * Written by Daniel Petrini, David Cohen, Anderson Briglia
10 * {daniel.petrini, david.cohen, anderson.briglia}@indt.org.br
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 *
32 * History
33 * -------
34 *
35 * 2005/07/25 INdT-10LE Kernel Team - Alsa driver for omap osk,
36 * original version based in sa1100 driver
37 * and omap oss driver.
38 */
39
40#ifndef __OMAP_ALSA_H
41#define __OMAP_ALSA_H
42
43#include <plat/dma.h>
44#include <sound/core.h>
45#include <sound/pcm.h>
46#include <plat/mcbsp.h>
47#include <linux/platform_device.h>
48
49#define DMA_BUF_SIZE (1024 * 8)
50
51/*
52 * Buffer management for alsa and dma
53 */
54struct audio_stream {
55 char *id; /* identification string */
56 int stream_id; /* numeric identification */
57 int dma_dev; /* dma number of that device */
58 int *lch; /* Chain of channels this stream is linked to */
59 char started; /* to store if the chain was started or not */
60 int dma_q_head; /* DMA Channel Q Head */
61 int dma_q_tail; /* DMA Channel Q Tail */
62 char dma_q_count; /* DMA Channel Q Count */
63 int active:1; /* we are using this stream for transfer now */
64 int period; /* current transfer period */
65 int periods; /* current count of periods registerd in the DMA engine */
66 spinlock_t dma_lock; /* for locking in DMA operations */
67 struct snd_pcm_substream *stream; /* the pcm stream */
68 unsigned linked:1; /* dma channels linked */
69 int offset; /* store start position of the last period in the alsa buffer */
70 int (*hw_start)(void); /* interface to start HW interface, e.g. McBSP */
71 int (*hw_stop)(void); /* interface to stop HW interface, e.g. McBSP */
72};
73
74/*
75 * Alsa card structure for aic23
76 */
77struct snd_card_omap_codec {
78 struct snd_card *card;
79 struct snd_pcm *pcm;
80 long samplerate;
81 struct audio_stream s[2]; /* playback & capture */
82};
83
84/* Codec specific information and function pointers.
85 * Codec (omap-alsa-aic23.c and omap-alsa-tsc2101.c)
86 * are responsible for defining the function pointers.
87 */
88struct omap_alsa_codec_config {
89 char *name;
90 struct omap_mcbsp_reg_cfg *mcbsp_regs_alsa;
91 struct snd_pcm_hw_constraint_list *hw_constraints_rates;
92 struct snd_pcm_hardware *snd_omap_alsa_playback;
93 struct snd_pcm_hardware *snd_omap_alsa_capture;
94 void (*codec_configure_dev)(void);
95 void (*codec_set_samplerate)(long);
96 void (*codec_clock_setup)(void);
97 int (*codec_clock_on)(void);
98 int (*codec_clock_off)(void);
99 int (*get_default_samplerate)(void);
100};
101
102/*********** Mixer function prototypes *************************/
103int snd_omap_mixer(struct snd_card_omap_codec *);
104void snd_omap_init_mixer(void);
105
106#ifdef CONFIG_PM
107void snd_omap_suspend_mixer(void);
108void snd_omap_resume_mixer(void);
109#endif
110
111int snd_omap_alsa_post_probe(struct platform_device *pdev, struct omap_alsa_codec_config *config);
112int snd_omap_alsa_remove(struct platform_device *pdev);
113#ifdef CONFIG_PM
114int snd_omap_alsa_suspend(struct platform_device *pdev, pm_message_t state);
115int snd_omap_alsa_resume(struct platform_device *pdev);
116#else
117#define snd_omap_alsa_suspend NULL
118#define snd_omap_alsa_resume NULL
119#endif
120
121void callback_omap_alsa_sound_dma(void *);
122
123#endif
diff --git a/arch/arm/plat-omap/include/plat/omap-pm.h b/arch/arm/plat-omap/include/plat/omap-pm.h
index 0840df813f4f..67faa7b8fe92 100644
--- a/arch/arm/plat-omap/include/plat/omap-pm.h
+++ b/arch/arm/plat-omap/include/plat/omap-pm.h
@@ -342,9 +342,9 @@ unsigned long omap_pm_cpu_get_freq(void);
342 * driver must restore device context. If the number of context losses 342 * driver must restore device context. If the number of context losses
343 * exceeds the maximum positive integer, the function will wrap to 0 and 343 * exceeds the maximum positive integer, the function will wrap to 0 and
344 * continue counting. Returns the number of context losses for this device, 344 * continue counting. Returns the number of context losses for this device,
345 * or zero upon error. 345 * or negative value upon error.
346 */ 346 */
347u32 omap_pm_get_dev_context_loss_count(struct device *dev); 347int omap_pm_get_dev_context_loss_count(struct device *dev);
348 348
349void omap_pm_enable_off_mode(void); 349void omap_pm_enable_off_mode(void);
350void omap_pm_disable_off_mode(void); 350void omap_pm_disable_off_mode(void);
diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
index 12c5b0c345bf..51423d2727a5 100644
--- a/arch/arm/plat-omap/include/plat/omap_device.h
+++ b/arch/arm/plat-omap/include/plat/omap_device.h
@@ -107,7 +107,7 @@ struct device *omap_device_get_by_hwmod_name(const char *oh_name);
107int omap_device_align_pm_lat(struct platform_device *pdev, 107int omap_device_align_pm_lat(struct platform_device *pdev,
108 u32 new_wakeup_lat_limit); 108 u32 new_wakeup_lat_limit);
109struct powerdomain *omap_device_get_pwrdm(struct omap_device *od); 109struct powerdomain *omap_device_get_pwrdm(struct omap_device *od);
110u32 omap_device_get_context_loss_count(struct platform_device *pdev); 110int omap_device_get_context_loss_count(struct platform_device *pdev);
111 111
112/* Other */ 112/* Other */
113 113
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index 5419f1a2aaa4..8b372ede17c1 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -600,7 +600,7 @@ int omap_hwmod_for_each_by_class(const char *classname,
600 void *user); 600 void *user);
601 601
602int omap_hwmod_set_postsetup_state(struct omap_hwmod *oh, u8 state); 602int omap_hwmod_set_postsetup_state(struct omap_hwmod *oh, u8 state);
603u32 omap_hwmod_get_context_loss_count(struct omap_hwmod *oh); 603int omap_hwmod_get_context_loss_count(struct omap_hwmod *oh);
604 604
605int omap_hwmod_no_setup_reset(struct omap_hwmod *oh); 605int omap_hwmod_no_setup_reset(struct omap_hwmod *oh);
606 606
diff --git a/arch/arm/plat-omap/omap-pm-noop.c b/arch/arm/plat-omap/omap-pm-noop.c
index b0471bb2d47d..3dc3801aace4 100644
--- a/arch/arm/plat-omap/omap-pm-noop.c
+++ b/arch/arm/plat-omap/omap-pm-noop.c
@@ -27,7 +27,7 @@
27#include <plat/omap_device.h> 27#include <plat/omap_device.h>
28 28
29static bool off_mode_enabled; 29static bool off_mode_enabled;
30static u32 dummy_context_loss_counter; 30static int dummy_context_loss_counter;
31 31
32/* 32/*
33 * Device-driver-originated constraints (via board-*.c files) 33 * Device-driver-originated constraints (via board-*.c files)
@@ -311,22 +311,32 @@ void omap_pm_disable_off_mode(void)
311 311
312#ifdef CONFIG_ARCH_OMAP2PLUS 312#ifdef CONFIG_ARCH_OMAP2PLUS
313 313
314u32 omap_pm_get_dev_context_loss_count(struct device *dev) 314int omap_pm_get_dev_context_loss_count(struct device *dev)
315{ 315{
316 struct platform_device *pdev = to_platform_device(dev); 316 struct platform_device *pdev = to_platform_device(dev);
317 u32 count; 317 int count;
318 318
319 if (WARN_ON(!dev)) 319 if (WARN_ON(!dev))
320 return 0; 320 return -ENODEV;
321 321
322 if (dev->parent == &omap_device_parent) { 322 if (dev->parent == &omap_device_parent) {
323 count = omap_device_get_context_loss_count(pdev); 323 count = omap_device_get_context_loss_count(pdev);
324 } else { 324 } else {
325 WARN_ONCE(off_mode_enabled, "omap_pm: using dummy context loss counter; device %s should be converted to omap_device", 325 WARN_ONCE(off_mode_enabled, "omap_pm: using dummy context loss counter; device %s should be converted to omap_device",
326 dev_name(dev)); 326 dev_name(dev));
327 if (off_mode_enabled) 327
328 dummy_context_loss_counter++;
329 count = dummy_context_loss_counter; 328 count = dummy_context_loss_counter;
329
330 if (off_mode_enabled) {
331 count++;
332 /*
333 * Context loss count has to be a non-negative value.
334 * Clear the sign bit to get a value range from 0 to
335 * INT_MAX.
336 */
337 count &= INT_MAX;
338 dummy_context_loss_counter = count;
339 }
330 } 340 }
331 341
332 pr_debug("OMAP PM: context loss count for dev %s = %d\n", 342 pr_debug("OMAP PM: context loss count for dev %s = %d\n",
@@ -337,7 +347,7 @@ u32 omap_pm_get_dev_context_loss_count(struct device *dev)
337 347
338#else 348#else
339 349
340u32 omap_pm_get_dev_context_loss_count(struct device *dev) 350int omap_pm_get_dev_context_loss_count(struct device *dev)
341{ 351{
342 return dummy_context_loss_counter; 352 return dummy_context_loss_counter;
343} 353}
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index cd90bedd9306..e8d98693d2dd 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -78,6 +78,7 @@
78#undef DEBUG 78#undef DEBUG
79 79
80#include <linux/kernel.h> 80#include <linux/kernel.h>
81#include <linux/export.h>
81#include <linux/platform_device.h> 82#include <linux/platform_device.h>
82#include <linux/slab.h> 83#include <linux/slab.h>
83#include <linux/err.h> 84#include <linux/err.h>
@@ -426,7 +427,7 @@ static int _omap_device_notifier_call(struct notifier_block *nb,
426 * return the context loss counter for that hwmod, otherwise return 427 * return the context loss counter for that hwmod, otherwise return
427 * zero. 428 * zero.
428 */ 429 */
429u32 omap_device_get_context_loss_count(struct platform_device *pdev) 430int omap_device_get_context_loss_count(struct platform_device *pdev)
430{ 431{
431 struct omap_device *od; 432 struct omap_device *od;
432 u32 ret = 0; 433 u32 ret = 0;