~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to drivers/media/video/omap3isp/ispstat.h

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno
  • Date: 2011-06-07 12:14:05 UTC
  • mfrom: (43.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110607121405-i3h1rd7nrnd2b73h
Tags: 2.6.39-2
[ Ben Hutchings ]
* [x86] Enable BACKLIGHT_APPLE, replacing BACKLIGHT_MBP_NVIDIA
  (Closes: #627492)
* cgroups: Disable memory resource controller by default. Allow it
  to be enabled using kernel parameter 'cgroup_enable=memory'.
* rt2800usb: Enable support for more USB devices including
  Linksys WUSB600N (Closes: #596626) (this change was accidentally
  omitted from 2.6.39-1)
* [x86] Remove Celeron from list of processors supporting PAE. Most
  'Celeron M' models do not.
* Update debconf template translations:
  - Swedish (Martin Bagge) (Closes: #628932)
  - French (David Prévot) (Closes: #628191)
* aufs: Update for 2.6.39 (Closes: #627837)
* Add stable 2.6.39.1, including:
  - ext4: dont set PageUptodate in ext4_end_bio()
  - pata_cmd64x: fix boot crash on parisc (Closes: #622997, #622745)
  - ext3: Fix fs corruption when make_indexed_dir() fails
  - netfilter: nf_ct_sip: validate Content-Length in TCP SIP messages
  - sctp: fix race between sctp_bind_addr_free() and
    sctp_bind_addr_conflict()
  - sctp: fix memory leak of the ASCONF queue when free asoc
  - md/bitmap: fix saving of events_cleared and other state
  - cdc_acm: Fix oops when Droids MuIn LCD is connected
  - cx88: Fix conversion from BKL to fine-grained locks (Closes: #619827)
  - keys: Set cred->user_ns in key_replace_session_keyring (CVE-2011-2184)
  - tmpfs: fix race between truncate and writepage
  - nfs41: Correct offset for LAYOUTCOMMIT
  - xen/mmu: fix a race window causing leave_mm BUG()
  - ext4: fix possible use-after-free in ext4_remove_li_request()
  For the complete list of changes, see:
   http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.39.1
* Bump ABI to 2
* netfilter: Enable IP_SET, IP_SET_BITMAP_IP, IP_SET_BITMAP_IPMAC,
  IP_SET_BITMAP_PORT, IP_SET_HASH_IP, IP_SET_HASH_IPPORT,
  IP_SET_HASH_IPPORTIP, IP_SET_HASH_IPPORTNET, IP_SET_HASH_NET,
  IP_SET_HASH_NETPORT, IP_SET_LIST_SET, NETFILTER_XT_SET as modules
  (Closes: #629401)

[ Aurelien Jarno ]
* [mipsel/loongson-2f] Disable_SCSI_LPFC to workaround GCC ICE.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * ispstat.h
 
3
 *
 
4
 * TI OMAP3 ISP - Statistics core
 
5
 *
 
6
 * Copyright (C) 2010 Nokia Corporation
 
7
 * Copyright (C) 2009 Texas Instruments, Inc
 
8
 *
 
9
 * Contacts: David Cohen <dacohen@gmail.com>
 
10
 *           Laurent Pinchart <laurent.pinchart@ideasonboard.com>
 
11
 *           Sakari Ailus <sakari.ailus@iki.fi>
 
12
 *
 
13
 * This program is free software; you can redistribute it and/or modify
 
14
 * it under the terms of the GNU General Public License version 2 as
 
15
 * published by the Free Software Foundation.
 
16
 *
 
17
 * This program is distributed in the hope that it will be useful, but
 
18
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
20
 * General Public License for more details.
 
21
 *
 
22
 * You should have received a copy of the GNU General Public License
 
23
 * along with this program; if not, write to the Free Software
 
24
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 
25
 * 02110-1301 USA
 
26
 */
 
27
 
 
28
#ifndef OMAP3_ISP_STAT_H
 
29
#define OMAP3_ISP_STAT_H
 
30
 
 
31
#include <linux/types.h>
 
32
#include <linux/omap3isp.h>
 
33
#include <plat/dma.h>
 
34
#include <media/v4l2-event.h>
 
35
 
 
36
#include "isp.h"
 
37
#include "ispvideo.h"
 
38
 
 
39
#define STAT_MAX_BUFS           5
 
40
#define STAT_NEVENTS            8
 
41
 
 
42
#define STAT_BUF_DONE           0       /* Buffer is ready */
 
43
#define STAT_NO_BUF             1       /* An error has occurred */
 
44
#define STAT_BUF_WAITING_DMA    2       /* Histogram only: DMA is running */
 
45
 
 
46
struct ispstat;
 
47
 
 
48
struct ispstat_buffer {
 
49
        unsigned long iommu_addr;
 
50
        struct iovm_struct *iovm;
 
51
        void *virt_addr;
 
52
        dma_addr_t dma_addr;
 
53
        struct timeval ts;
 
54
        u32 buf_size;
 
55
        u32 frame_number;
 
56
        u16 config_counter;
 
57
        u8 empty;
 
58
};
 
59
 
 
60
struct ispstat_ops {
 
61
        /*
 
62
         * Validate new params configuration.
 
63
         * new_conf->buf_size value must be changed to the exact buffer size
 
64
         * necessary for the new configuration if it's smaller.
 
65
         */
 
66
        int (*validate_params)(struct ispstat *stat, void *new_conf);
 
67
 
 
68
        /*
 
69
         * Save new params configuration.
 
70
         * stat->priv->buf_size value must be set to the exact buffer size for
 
71
         * the new configuration.
 
72
         * stat->update is set to 1 if new configuration is different than
 
73
         * current one.
 
74
         */
 
75
        void (*set_params)(struct ispstat *stat, void *new_conf);
 
76
 
 
77
        /* Apply stored configuration. */
 
78
        void (*setup_regs)(struct ispstat *stat, void *priv);
 
79
 
 
80
        /* Enable/Disable module. */
 
81
        void (*enable)(struct ispstat *stat, int enable);
 
82
 
 
83
        /* Verify is module is busy. */
 
84
        int (*busy)(struct ispstat *stat);
 
85
 
 
86
        /* Used for specific operations during generic buf process task. */
 
87
        int (*buf_process)(struct ispstat *stat);
 
88
};
 
89
 
 
90
enum ispstat_state_t {
 
91
        ISPSTAT_DISABLED = 0,
 
92
        ISPSTAT_DISABLING,
 
93
        ISPSTAT_ENABLED,
 
94
        ISPSTAT_ENABLING,
 
95
        ISPSTAT_SUSPENDED,
 
96
};
 
97
 
 
98
struct ispstat {
 
99
        struct v4l2_subdev subdev;
 
100
        struct media_pad pad;   /* sink pad */
 
101
 
 
102
        /* Control */
 
103
        unsigned configured:1;
 
104
        unsigned update:1;
 
105
        unsigned buf_processing:1;
 
106
        unsigned sbl_ovl_recover:1;
 
107
        u8 inc_config;
 
108
        atomic_t buf_err;
 
109
        enum ispstat_state_t state;     /* enabling/disabling state */
 
110
        struct omap_dma_channel_params dma_config;
 
111
        struct isp_device *isp;
 
112
        void *priv;             /* pointer to priv config struct */
 
113
        void *recover_priv;     /* pointer to recover priv configuration */
 
114
        struct mutex ioctl_lock; /* serialize private ioctl */
 
115
 
 
116
        const struct ispstat_ops *ops;
 
117
 
 
118
        /* Buffer */
 
119
        u8 wait_acc_frames;
 
120
        u16 config_counter;
 
121
        u32 frame_number;
 
122
        u32 buf_size;
 
123
        u32 buf_alloc_size;
 
124
        int dma_ch;
 
125
        unsigned long event_type;
 
126
        struct ispstat_buffer *buf;
 
127
        struct ispstat_buffer *active_buf;
 
128
        struct ispstat_buffer *locked_buf;
 
129
};
 
130
 
 
131
struct ispstat_generic_config {
 
132
        /*
 
133
         * Fields must be in the same order as in:
 
134
         *  - omap3isp_h3a_aewb_config
 
135
         *  - omap3isp_h3a_af_config
 
136
         *  - omap3isp_hist_config
 
137
         */
 
138
        u32 buf_size;
 
139
        u16 config_counter;
 
140
};
 
141
 
 
142
int omap3isp_stat_config(struct ispstat *stat, void *new_conf);
 
143
int omap3isp_stat_request_statistics(struct ispstat *stat,
 
144
                                     struct omap3isp_stat_data *data);
 
145
int omap3isp_stat_init(struct ispstat *stat, const char *name,
 
146
                       const struct v4l2_subdev_ops *sd_ops);
 
147
void omap3isp_stat_free(struct ispstat *stat);
 
148
int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev,
 
149
                                  struct v4l2_fh *fh,
 
150
                                  struct v4l2_event_subscription *sub);
 
151
int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev,
 
152
                                    struct v4l2_fh *fh,
 
153
                                    struct v4l2_event_subscription *sub);
 
154
int omap3isp_stat_s_stream(struct v4l2_subdev *subdev, int enable);
 
155
 
 
156
int omap3isp_stat_busy(struct ispstat *stat);
 
157
int omap3isp_stat_pcr_busy(struct ispstat *stat);
 
158
void omap3isp_stat_suspend(struct ispstat *stat);
 
159
void omap3isp_stat_resume(struct ispstat *stat);
 
160
int omap3isp_stat_enable(struct ispstat *stat, u8 enable);
 
161
void omap3isp_stat_sbl_overflow(struct ispstat *stat);
 
162
void omap3isp_stat_isr(struct ispstat *stat);
 
163
void omap3isp_stat_isr_frame_sync(struct ispstat *stat);
 
164
void omap3isp_stat_dma_isr(struct ispstat *stat);
 
165
int omap3isp_stat_register_entities(struct ispstat *stat,
 
166
                                    struct v4l2_device *vdev);
 
167
void omap3isp_stat_unregister_entities(struct ispstat *stat);
 
168
 
 
169
#endif /* OMAP3_ISP_STAT_H */