ALSA: ASoC: TLV320AIC3X: Modify only interface related bits in aic3x_set_dai_fmt
[linux-ginger.git] / drivers / ide / ide-cd.h
bloba58801c4484d309177afe8b7d32aa77c7ac7f91f
1 /*
2 * Copyright (C) 1996-98 Erik Andersen
3 * Copyright (C) 1998-2000 Jens Axboe
4 */
5 #ifndef _IDE_CD_H
6 #define _IDE_CD_H
8 #include <linux/cdrom.h>
9 #include <asm/byteorder.h>
12 * typical timeout for packet command
14 #define ATAPI_WAIT_PC (60 * HZ)
15 #define ATAPI_WAIT_WRITE_BUSY (10 * HZ)
17 /************************************************************************/
19 #define SECTOR_BITS 9
20 #ifndef SECTOR_SIZE
21 #define SECTOR_SIZE (1 << SECTOR_BITS)
22 #endif
23 #define SECTORS_PER_FRAME (CD_FRAMESIZE >> SECTOR_BITS)
24 #define SECTOR_BUFFER_SIZE (CD_FRAMESIZE * 32)
26 /* Capabilities Page size including 8 bytes of Mode Page Header */
27 #define ATAPI_CAPABILITIES_PAGE_SIZE (8 + 20)
28 #define ATAPI_CAPABILITIES_PAGE_PAD_SIZE 4
30 enum {
31 /* Device sends an interrupt when ready for a packet command. */
32 IDE_CD_FLAG_DRQ_INTERRUPT = (1 << 0),
33 /* Drive cannot lock the door. */
34 IDE_CD_FLAG_NO_DOORLOCK = (1 << 1),
35 /* Drive cannot eject the disc. */
36 IDE_CD_FLAG_NO_EJECT = (1 << 2),
37 /* Drive is a pre ATAPI 1.2 drive. */
38 IDE_CD_FLAG_PRE_ATAPI12 = (1 << 3),
39 /* TOC addresses are in BCD. */
40 IDE_CD_FLAG_TOCADDR_AS_BCD = (1 << 4),
41 /* TOC track numbers are in BCD. */
42 IDE_CD_FLAG_TOCTRACKS_AS_BCD = (1 << 5),
44 * Drive does not provide data in multiples of SECTOR_SIZE
45 * when more than one interrupt is needed.
47 IDE_CD_FLAG_LIMIT_NFRAMES = (1 << 6),
48 /* Seeking in progress. */
49 IDE_CD_FLAG_SEEKING = (1 << 7),
50 /* Driver has noticed a media change. */
51 IDE_CD_FLAG_MEDIA_CHANGED = (1 << 8),
52 /* Saved TOC information is current. */
53 IDE_CD_FLAG_TOC_VALID = (1 << 9),
54 /* We think that the drive door is locked. */
55 IDE_CD_FLAG_DOOR_LOCKED = (1 << 10),
56 /* SET_CD_SPEED command is unsupported. */
57 IDE_CD_FLAG_NO_SPEED_SELECT = (1 << 11),
58 IDE_CD_FLAG_VERTOS_300_SSD = (1 << 12),
59 IDE_CD_FLAG_VERTOS_600_ESD = (1 << 13),
60 IDE_CD_FLAG_SANYO_3CD = (1 << 14),
61 IDE_CD_FLAG_FULL_CAPS_PAGE = (1 << 15),
62 IDE_CD_FLAG_PLAY_AUDIO_OK = (1 << 16),
63 IDE_CD_FLAG_LE_SPEED_FIELDS = (1 << 17),
66 /* Structure of a MSF cdrom address. */
67 struct atapi_msf {
68 byte reserved;
69 byte minute;
70 byte second;
71 byte frame;
74 /* Space to hold the disk TOC. */
75 #define MAX_TRACKS 99
76 struct atapi_toc_header {
77 unsigned short toc_length;
78 byte first_track;
79 byte last_track;
82 struct atapi_toc_entry {
83 byte reserved1;
84 #if defined(__BIG_ENDIAN_BITFIELD)
85 __u8 adr : 4;
86 __u8 control : 4;
87 #elif defined(__LITTLE_ENDIAN_BITFIELD)
88 __u8 control : 4;
89 __u8 adr : 4;
90 #else
91 #error "Please fix <asm/byteorder.h>"
92 #endif
93 byte track;
94 byte reserved2;
95 union {
96 unsigned lba;
97 struct atapi_msf msf;
98 } addr;
101 struct atapi_toc {
102 int last_session_lba;
103 int xa_flag;
104 unsigned long capacity;
105 struct atapi_toc_header hdr;
106 struct atapi_toc_entry ent[MAX_TRACKS+1];
107 /* One extra for the leadout. */
110 /* Extra per-device info for cdrom drives. */
111 struct cdrom_info {
112 ide_drive_t *drive;
113 ide_driver_t *driver;
114 struct gendisk *disk;
115 struct kref kref;
117 /* Buffer for table of contents. NULL if we haven't allocated
118 a TOC buffer for this device yet. */
120 struct atapi_toc *toc;
122 /* The result of the last successful request sense command
123 on this device. */
124 struct request_sense sense_data;
126 struct request request_sense_request;
127 int dma;
128 unsigned long last_block;
129 unsigned long start_seek;
131 unsigned int cd_flags;
133 u8 max_speed; /* Max speed of the drive. */
134 u8 current_speed; /* Current speed of the drive. */
136 /* Per-device info needed by cdrom.c generic driver. */
137 struct cdrom_device_info devinfo;
139 unsigned long write_timeout;
142 /* ide-cd_verbose.c */
143 void ide_cd_log_error(const char *, struct request *, struct request_sense *);
145 /* ide-cd.c functions used by ide-cd_ioctl.c */
146 void ide_cd_init_rq(ide_drive_t *, struct request *);
147 int ide_cd_queue_pc(ide_drive_t *, struct request *);
148 int ide_cd_read_toc(ide_drive_t *, struct request_sense *);
149 int ide_cdrom_get_capabilities(ide_drive_t *, u8 *);
150 void ide_cdrom_update_speed(ide_drive_t *, u8 *);
151 int cdrom_check_status(ide_drive_t *, struct request_sense *);
153 /* ide-cd_ioctl.c */
154 int ide_cdrom_open_real(struct cdrom_device_info *, int);
155 void ide_cdrom_release_real(struct cdrom_device_info *);
156 int ide_cdrom_drive_status(struct cdrom_device_info *, int);
157 int ide_cdrom_check_media_change_real(struct cdrom_device_info *, int);
158 int ide_cdrom_tray_move(struct cdrom_device_info *, int);
159 int ide_cdrom_lock_door(struct cdrom_device_info *, int);
160 int ide_cdrom_select_speed(struct cdrom_device_info *, int);
161 int ide_cdrom_get_last_session(struct cdrom_device_info *,
162 struct cdrom_multisession *);
163 int ide_cdrom_get_mcn(struct cdrom_device_info *, struct cdrom_mcn *);
164 int ide_cdrom_reset(struct cdrom_device_info *cdi);
165 int ide_cdrom_audio_ioctl(struct cdrom_device_info *, unsigned int, void *);
166 int ide_cdrom_packet(struct cdrom_device_info *, struct packet_command *);
168 #endif /* _IDE_CD_H */