Commit d351cf46 authored by Takashi Iwai's avatar Takashi Iwai

Merge branch 'topic/misc' into for-linus

parents 433e8327 4a122c10
...@@ -96,6 +96,10 @@ ...@@ -96,6 +96,10 @@
#define AC97_FUNC_INFO 0x68 /* Function Information */ #define AC97_FUNC_INFO 0x68 /* Function Information */
#define AC97_SENSE_INFO 0x6a /* Sense Details */ #define AC97_SENSE_INFO 0x6a /* Sense Details */
/* volume controls */
#define AC97_MUTE_MASK_MONO 0x8000
#define AC97_MUTE_MASK_STEREO 0x8080
/* slot allocation */ /* slot allocation */
#define AC97_SLOT_TAG 0 #define AC97_SLOT_TAG 0
#define AC97_SLOT_CMD_ADDR 1 #define AC97_SLOT_CMD_ADDR 1
...@@ -138,6 +142,7 @@ ...@@ -138,6 +142,7 @@
#define AC97_BC_18BIT_ADC 0x0100 /* 18-bit ADC resolution */ #define AC97_BC_18BIT_ADC 0x0100 /* 18-bit ADC resolution */
#define AC97_BC_20BIT_ADC 0x0200 /* 20-bit ADC resolution */ #define AC97_BC_20BIT_ADC 0x0200 /* 20-bit ADC resolution */
#define AC97_BC_ADC_MASK 0x0300 #define AC97_BC_ADC_MASK 0x0300
#define AC97_BC_3D_TECH_ID_MASK 0x7c00 /* Per-vendor ID of 3D enhancement */
/* general purpose */ /* general purpose */
#define AC97_GP_DRSS_MASK 0x0c00 /* double rate slot select */ #define AC97_GP_DRSS_MASK 0x0c00 /* double rate slot select */
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
/* /*
* Copyright (C) 2003 Winfried Ritsch (IEM) * Copyright (C) 2003 Winfried Ritsch (IEM)
* based on hdsp.h from Thomas Charbonnel (thomas@undata.org) * based on hdsp.h from Thomas Charbonnel (thomas@undata.org)
* *
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
...@@ -23,50 +23,41 @@ ...@@ -23,50 +23,41 @@
/* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */ /* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */
#define HDSPM_MAX_CHANNELS 64 #define HDSPM_MAX_CHANNELS 64
/* -------------------- IOCTL Peak/RMS Meters -------------------- */ enum hdspm_io_type {
MADI,
/* peam rms level structure like we get from hardware MADIface,
AIO,
maybe in future we can memory map it so I just copy it AES32,
to user on ioctl call now an dont change anything RayDAT
rms are made out of low and high values };
where (long) ????_rms = (????_rms_l >> 8) + ((????_rms_h & 0xFFFFFF00)<<24)
(i asume so from the code)
*/
struct hdspm_peak_rms {
unsigned int level_offset[1024];
unsigned int input_peak[64]; enum hdspm_speed {
unsigned int playback_peak[64]; ss,
unsigned int output_peak[64]; ds,
unsigned int xxx_peak[64]; /* not used */ qs
};
unsigned int reserved[256]; /* not used */ /* -------------------- IOCTL Peak/RMS Meters -------------------- */
unsigned int input_rms_l[64]; struct hdspm_peak_rms {
unsigned int playback_rms_l[64]; uint32_t input_peaks[64];
unsigned int output_rms_l[64]; uint32_t playback_peaks[64];
unsigned int xxx_rms_l[64]; /* not used */ uint32_t output_peaks[64];
unsigned int input_rms_h[64]; uint64_t input_rms[64];
unsigned int playback_rms_h[64]; uint64_t playback_rms[64];
unsigned int output_rms_h[64]; uint64_t output_rms[64];
unsigned int xxx_rms_h[64]; /* not used */
};
struct hdspm_peak_rms_ioctl { uint8_t speed; /* enum {ss, ds, qs} */
struct hdspm_peak_rms *peak; int status2;
}; };
/* use indirect access due to the limit of ioctl bit size */
#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \ #define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \
_IOR('H', 0x40, struct hdspm_peak_rms_ioctl) _IOR('H', 0x42, struct hdspm_peak_rms)
/* ------------ CONFIG block IOCTL ---------------------- */ /* ------------ CONFIG block IOCTL ---------------------- */
struct hdspm_config_info { struct hdspm_config {
unsigned char pref_sync_ref; unsigned char pref_sync_ref;
unsigned char wordclock_sync_check; unsigned char wordclock_sync_check;
unsigned char madi_sync_check; unsigned char madi_sync_check;
...@@ -80,18 +71,121 @@ struct hdspm_config_info { ...@@ -80,18 +71,121 @@ struct hdspm_config_info {
unsigned int analog_out; unsigned int analog_out;
}; };
#define SNDRV_HDSPM_IOCTL_GET_CONFIG_INFO \ #define SNDRV_HDSPM_IOCTL_GET_CONFIG \
_IOR('H', 0x41, struct hdspm_config_info) _IOR('H', 0x41, struct hdspm_config)
/**
* If there's a TCO (TimeCode Option) board installed,
* there are further options and status data available.
* The hdspm_ltc structure contains the current SMPTE
* timecode and some status information and can be
* obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the
* hdspm_status struct.
**/
enum hdspm_ltc_format {
format_invalid,
fps_24,
fps_25,
fps_2997,
fps_30
};
enum hdspm_ltc_frame {
frame_invalid,
drop_frame,
full_frame
};
enum hdspm_ltc_input_format {
ntsc,
pal,
no_video
};
struct hdspm_ltc {
unsigned int ltc;
enum hdspm_ltc_format format;
enum hdspm_ltc_frame frame;
enum hdspm_ltc_input_format input_format;
};
#define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_mixer_ioctl)
/**
* The status data reflects the device's current state
* as determined by the card's configuration and
* connection status.
**/
enum hdspm_sync {
hdspm_sync_no_lock = 0,
hdspm_sync_lock = 1,
hdspm_sync_sync = 2
};
/* get Soundcard Version */ enum hdspm_madi_input {
hdspm_input_optical = 0,
hdspm_input_coax = 1
};
enum hdspm_madi_channel_format {
hdspm_format_ch_64 = 0,
hdspm_format_ch_56 = 1
};
enum hdspm_madi_frame_format {
hdspm_frame_48 = 0,
hdspm_frame_96 = 1
};
enum hdspm_syncsource {
syncsource_wc = 0,
syncsource_madi = 1,
syncsource_tco = 2,
syncsource_sync = 3,
syncsource_none = 4
};
struct hdspm_status {
uint8_t card_type; /* enum hdspm_io_type */
enum hdspm_syncsource autosync_source;
uint64_t card_clock;
uint32_t master_period;
union {
struct {
uint8_t sync_wc; /* enum hdspm_sync */
uint8_t sync_madi; /* enum hdspm_sync */
uint8_t sync_tco; /* enum hdspm_sync */
uint8_t sync_in; /* enum hdspm_sync */
uint8_t madi_input; /* enum hdspm_madi_input */
uint8_t channel_format; /* enum hdspm_madi_channel_format */
uint8_t frame_format; /* enum hdspm_madi_frame_format */
} madi;
} card_specific;
};
#define SNDRV_HDSPM_IOCTL_GET_STATUS \
_IOR('H', 0x47, struct hdspm_status)
/**
* Get information about the card and its add-ons.
**/
#define HDSPM_ADDON_TCO 1
struct hdspm_version { struct hdspm_version {
uint8_t card_type; /* enum hdspm_io_type */
char cardname[20];
unsigned int serial;
unsigned short firmware_rev; unsigned short firmware_rev;
int addons;
}; };
#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdspm_version) #define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x48, struct hdspm_version)
/* ------------- get Matrix Mixer IOCTL --------------- */ /* ------------- get Matrix Mixer IOCTL --------------- */
...@@ -103,7 +197,7 @@ struct hdspm_version { ...@@ -103,7 +197,7 @@ struct hdspm_version {
/* equivalent to hardware definition, maybe for future feature of mmap of /* equivalent to hardware definition, maybe for future feature of mmap of
* them * them
*/ */
/* each of 64 outputs has 64 infader and 64 outfader: /* each of 64 outputs has 64 infader and 64 outfader:
Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */ Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */
#define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS #define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS
...@@ -131,4 +225,5 @@ typedef struct hdspm_version hdspm_version_t; ...@@ -131,4 +225,5 @@ typedef struct hdspm_version hdspm_version_t;
typedef struct hdspm_channelfader snd_hdspm_channelfader_t; typedef struct hdspm_channelfader snd_hdspm_channelfader_t;
typedef struct hdspm_mixer hdspm_mixer_t; typedef struct hdspm_mixer hdspm_mixer_t;
#endif /* __SOUND_HDSPM_H */
#endif
...@@ -73,6 +73,9 @@ struct snd_mixer_oss_file { ...@@ -73,6 +73,9 @@ struct snd_mixer_oss_file {
struct snd_mixer_oss *mixer; struct snd_mixer_oss *mixer;
}; };
int snd_mixer_oss_ioctl_card(struct snd_card *card,
unsigned int cmd, unsigned long arg);
#endif /* CONFIG_SND_MIXER_OSS */ #endif /* CONFIG_SND_MIXER_OSS */
#endif /* __SOUND_MIXER_OSS_H */ #endif /* __SOUND_MIXER_OSS_H */
...@@ -136,48 +136,49 @@ struct snd_pcm_ops { ...@@ -136,48 +136,49 @@ struct snd_pcm_ops {
SNDRV_PCM_RATE_88200|SNDRV_PCM_RATE_96000) SNDRV_PCM_RATE_88200|SNDRV_PCM_RATE_96000)
#define SNDRV_PCM_RATE_8000_192000 (SNDRV_PCM_RATE_8000_96000|SNDRV_PCM_RATE_176400|\ #define SNDRV_PCM_RATE_8000_192000 (SNDRV_PCM_RATE_8000_96000|SNDRV_PCM_RATE_176400|\
SNDRV_PCM_RATE_192000) SNDRV_PCM_RATE_192000)
#define SNDRV_PCM_FMTBIT_S8 (1ULL << SNDRV_PCM_FORMAT_S8) #define _SNDRV_PCM_FMTBIT(fmt) (1ULL << (__force int)SNDRV_PCM_FORMAT_##fmt)
#define SNDRV_PCM_FMTBIT_U8 (1ULL << SNDRV_PCM_FORMAT_U8) #define SNDRV_PCM_FMTBIT_S8 _SNDRV_PCM_FMTBIT(S8)
#define SNDRV_PCM_FMTBIT_S16_LE (1ULL << SNDRV_PCM_FORMAT_S16_LE) #define SNDRV_PCM_FMTBIT_U8 _SNDRV_PCM_FMTBIT(U8)
#define SNDRV_PCM_FMTBIT_S16_BE (1ULL << SNDRV_PCM_FORMAT_S16_BE) #define SNDRV_PCM_FMTBIT_S16_LE _SNDRV_PCM_FMTBIT(S16_LE)
#define SNDRV_PCM_FMTBIT_U16_LE (1ULL << SNDRV_PCM_FORMAT_U16_LE) #define SNDRV_PCM_FMTBIT_S16_BE _SNDRV_PCM_FMTBIT(S16_BE)
#define SNDRV_PCM_FMTBIT_U16_BE (1ULL << SNDRV_PCM_FORMAT_U16_BE) #define SNDRV_PCM_FMTBIT_U16_LE _SNDRV_PCM_FMTBIT(U16_LE)
#define SNDRV_PCM_FMTBIT_S24_LE (1ULL << SNDRV_PCM_FORMAT_S24_LE) #define SNDRV_PCM_FMTBIT_U16_BE _SNDRV_PCM_FMTBIT(U16_BE)
#define SNDRV_PCM_FMTBIT_S24_BE (1ULL << SNDRV_PCM_FORMAT_S24_BE) #define SNDRV_PCM_FMTBIT_S24_LE _SNDRV_PCM_FMTBIT(S24_LE)
#define SNDRV_PCM_FMTBIT_U24_LE (1ULL << SNDRV_PCM_FORMAT_U24_LE) #define SNDRV_PCM_FMTBIT_S24_BE _SNDRV_PCM_FMTBIT(S24_BE)
#define SNDRV_PCM_FMTBIT_U24_BE (1ULL << SNDRV_PCM_FORMAT_U24_BE) #define SNDRV_PCM_FMTBIT_U24_LE _SNDRV_PCM_FMTBIT(U24_LE)
#define SNDRV_PCM_FMTBIT_S32_LE (1ULL << SNDRV_PCM_FORMAT_S32_LE) #define SNDRV_PCM_FMTBIT_U24_BE _SNDRV_PCM_FMTBIT(U24_BE)
#define SNDRV_PCM_FMTBIT_S32_BE (1ULL << SNDRV_PCM_FORMAT_S32_BE) #define SNDRV_PCM_FMTBIT_S32_LE _SNDRV_PCM_FMTBIT(S32_LE)
#define SNDRV_PCM_FMTBIT_U32_LE (1ULL << SNDRV_PCM_FORMAT_U32_LE) #define SNDRV_PCM_FMTBIT_S32_BE _SNDRV_PCM_FMTBIT(S32_BE)
#define SNDRV_PCM_FMTBIT_U32_BE (1ULL << SNDRV_PCM_FORMAT_U32_BE) #define SNDRV_PCM_FMTBIT_U32_LE _SNDRV_PCM_FMTBIT(U32_LE)
#define SNDRV_PCM_FMTBIT_FLOAT_LE (1ULL << SNDRV_PCM_FORMAT_FLOAT_LE) #define SNDRV_PCM_FMTBIT_U32_BE _SNDRV_PCM_FMTBIT(U32_BE)
#define SNDRV_PCM_FMTBIT_FLOAT_BE (1ULL << SNDRV_PCM_FORMAT_FLOAT_BE) #define SNDRV_PCM_FMTBIT_FLOAT_LE _SNDRV_PCM_FMTBIT(FLOAT_LE)
#define SNDRV_PCM_FMTBIT_FLOAT64_LE (1ULL << SNDRV_PCM_FORMAT_FLOAT64_LE) #define SNDRV_PCM_FMTBIT_FLOAT_BE _SNDRV_PCM_FMTBIT(FLOAT_BE)
#define SNDRV_PCM_FMTBIT_FLOAT64_BE (1ULL << SNDRV_PCM_FORMAT_FLOAT64_BE) #define SNDRV_PCM_FMTBIT_FLOAT64_LE _SNDRV_PCM_FMTBIT(FLOAT64_LE)
#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE (1ULL << SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE) #define SNDRV_PCM_FMTBIT_FLOAT64_BE _SNDRV_PCM_FMTBIT(FLOAT64_BE)
#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE (1ULL << SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE) #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE _SNDRV_PCM_FMTBIT(IEC958_SUBFRAME_LE)
#define SNDRV_PCM_FMTBIT_MU_LAW (1ULL << SNDRV_PCM_FORMAT_MU_LAW) #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE _SNDRV_PCM_FMTBIT(IEC958_SUBFRAME_BE)
#define SNDRV_PCM_FMTBIT_A_LAW (1ULL << SNDRV_PCM_FORMAT_A_LAW) #define SNDRV_PCM_FMTBIT_MU_LAW _SNDRV_PCM_FMTBIT(MU_LAW)
#define SNDRV_PCM_FMTBIT_IMA_ADPCM (1ULL << SNDRV_PCM_FORMAT_IMA_ADPCM) #define SNDRV_PCM_FMTBIT_A_LAW _SNDRV_PCM_FMTBIT(A_LAW)
#define SNDRV_PCM_FMTBIT_MPEG (1ULL << SNDRV_PCM_FORMAT_MPEG) #define SNDRV_PCM_FMTBIT_IMA_ADPCM _SNDRV_PCM_FMTBIT(IMA_ADPCM)
#define SNDRV_PCM_FMTBIT_GSM (1ULL << SNDRV_PCM_FORMAT_GSM) #define SNDRV_PCM_FMTBIT_MPEG _SNDRV_PCM_FMTBIT(MPEG)
#define SNDRV_PCM_FMTBIT_SPECIAL (1ULL << SNDRV_PCM_FORMAT_SPECIAL) #define SNDRV_PCM_FMTBIT_GSM _SNDRV_PCM_FMTBIT(GSM)
#define SNDRV_PCM_FMTBIT_S24_3LE (1ULL << SNDRV_PCM_FORMAT_S24_3LE) #define SNDRV_PCM_FMTBIT_SPECIAL _SNDRV_PCM_FMTBIT(SPECIAL)
#define SNDRV_PCM_FMTBIT_U24_3LE (1ULL << SNDRV_PCM_FORMAT_U24_3LE) #define SNDRV_PCM_FMTBIT_S24_3LE _SNDRV_PCM_FMTBIT(S24_3LE)
#define SNDRV_PCM_FMTBIT_S24_3BE (1ULL << SNDRV_PCM_FORMAT_S24_3BE) #define SNDRV_PCM_FMTBIT_U24_3LE _SNDRV_PCM_FMTBIT(U24_3LE)
#define SNDRV_PCM_FMTBIT_U24_3BE (1ULL << SNDRV_PCM_FORMAT_U24_3BE) #define SNDRV_PCM_FMTBIT_S24_3BE _SNDRV_PCM_FMTBIT(S24_3BE)
#define SNDRV_PCM_FMTBIT_S20_3LE (1ULL << SNDRV_PCM_FORMAT_S20_3LE) #define SNDRV_PCM_FMTBIT_U24_3BE _SNDRV_PCM_FMTBIT(U24_3BE)
#define SNDRV_PCM_FMTBIT_U20_3LE (1ULL << SNDRV_PCM_FORMAT_U20_3LE) #define SNDRV_PCM_FMTBIT_S20_3LE _SNDRV_PCM_FMTBIT(S20_3LE)
#define SNDRV_PCM_FMTBIT_S20_3BE (1ULL << SNDRV_PCM_FORMAT_S20_3BE) #define SNDRV_PCM_FMTBIT_U20_3LE _SNDRV_PCM_FMTBIT(U20_3LE)
#define SNDRV_PCM_FMTBIT_U20_3BE (1ULL << SNDRV_PCM_FORMAT_U20_3BE) #define SNDRV_PCM_FMTBIT_S20_3BE _SNDRV_PCM_FMTBIT(S20_3BE)
#define SNDRV_PCM_FMTBIT_S18_3LE (1ULL << SNDRV_PCM_FORMAT_S18_3LE) #define SNDRV_PCM_FMTBIT_U20_3BE _SNDRV_PCM_FMTBIT(U20_3BE)
#define SNDRV_PCM_FMTBIT_U18_3LE (1ULL << SNDRV_PCM_FORMAT_U18_3LE) #define SNDRV_PCM_FMTBIT_S18_3LE _SNDRV_PCM_FMTBIT(S18_3LE)
#define SNDRV_PCM_FMTBIT_S18_3BE (1ULL << SNDRV_PCM_FORMAT_S18_3BE) #define SNDRV_PCM_FMTBIT_U18_3LE _SNDRV_PCM_FMTBIT(U18_3LE)
#define SNDRV_PCM_FMTBIT_U18_3BE (1ULL << SNDRV_PCM_FORMAT_U18_3BE) #define SNDRV_PCM_FMTBIT_S18_3BE _SNDRV_PCM_FMTBIT(S18_3BE)
#define SNDRV_PCM_FMTBIT_G723_24 (1ULL << SNDRV_PCM_FORMAT_G723_24) #define SNDRV_PCM_FMTBIT_U18_3BE _SNDRV_PCM_FMTBIT(U18_3BE)
#define SNDRV_PCM_FMTBIT_G723_24_1B (1ULL << SNDRV_PCM_FORMAT_G723_24_1B) #define SNDRV_PCM_FMTBIT_G723_24 _SNDRV_PCM_FMTBIT(G723_24)
#define SNDRV_PCM_FMTBIT_G723_40 (1ULL << SNDRV_PCM_FORMAT_G723_40) #define SNDRV_PCM_FMTBIT_G723_24_1B _SNDRV_PCM_FMTBIT(G723_24_1B)
#define SNDRV_PCM_FMTBIT_G723_40_1B (1ULL << SNDRV_PCM_FORMAT_G723_40_1B) #define SNDRV_PCM_FMTBIT_G723_40 _SNDRV_PCM_FMTBIT(G723_40)
#define SNDRV_PCM_FMTBIT_G723_40_1B _SNDRV_PCM_FMTBIT(G723_40_1B)
#ifdef SNDRV_LITTLE_ENDIAN #ifdef SNDRV_LITTLE_ENDIAN
#define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE #define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE
...@@ -490,7 +491,7 @@ int snd_pcm_info_user(struct snd_pcm_substream *substream, ...@@ -490,7 +491,7 @@ int snd_pcm_info_user(struct snd_pcm_substream *substream,
int snd_pcm_status(struct snd_pcm_substream *substream, int snd_pcm_status(struct snd_pcm_substream *substream,
struct snd_pcm_status *status); struct snd_pcm_status *status);
int snd_pcm_start(struct snd_pcm_substream *substream); int snd_pcm_start(struct snd_pcm_substream *substream);
int snd_pcm_stop(struct snd_pcm_substream *substream, int status); int snd_pcm_stop(struct snd_pcm_substream *substream, snd_pcm_state_t status);
int snd_pcm_drain_done(struct snd_pcm_substream *substream); int snd_pcm_drain_done(struct snd_pcm_substream *substream);
#ifdef CONFIG_PM #ifdef CONFIG_PM
int snd_pcm_suspend(struct snd_pcm_substream *substream); int snd_pcm_suspend(struct snd_pcm_substream *substream);
...@@ -748,8 +749,8 @@ static inline const struct snd_interval *hw_param_interval_c(const struct snd_pc ...@@ -748,8 +749,8 @@ static inline const struct snd_interval *hw_param_interval_c(const struct snd_pc
return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
} }
#define params_access(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS)) #define params_access(p) ((__force snd_pcm_access_t)snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS)))
#define params_format(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_FORMAT)) #define params_format(p) ((__force snd_pcm_format_t)snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_FORMAT)))
#define params_subformat(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_SUBFORMAT)) #define params_subformat(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_SUBFORMAT))
#define params_channels(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_CHANNELS)->min #define params_channels(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_CHANNELS)->min
#define params_rate(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_RATE)->min #define params_rate(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_RATE)->min
......
/* include/version.h */ /* include/version.h */
#define CONFIG_SND_VERSION "1.0.23" #define CONFIG_SND_VERSION "1.0.24"
#define CONFIG_SND_DATE "" #define CONFIG_SND_DATE ""
...@@ -279,33 +279,31 @@ void snd_ctl_free_one(struct snd_kcontrol *kcontrol) ...@@ -279,33 +279,31 @@ void snd_ctl_free_one(struct snd_kcontrol *kcontrol)
EXPORT_SYMBOL(snd_ctl_free_one); EXPORT_SYMBOL(snd_ctl_free_one);
static unsigned int snd_ctl_hole_check(struct snd_card *card, static bool snd_ctl_remove_numid_conflict(struct snd_card *card,
unsigned int count) unsigned int count)
{ {
struct snd_kcontrol *kctl; struct snd_kcontrol *kctl;
list_for_each_entry(kctl, &card->controls, list) { list_for_each_entry(kctl, &card->controls, list) {
if ((kctl->id.numid <= card->last_numid && if (kctl->id.numid < card->last_numid + 1 + count &&
kctl->id.numid + kctl->count > card->last_numid) || kctl->id.numid + kctl->count > card->last_numid + 1) {
(kctl->id.numid <= card->last_numid + count - 1 && card->last_numid = kctl->id.numid + kctl->count - 1;
kctl->id.numid + kctl->count > card->last_numid + count - 1)) return true;
return card->last_numid = kctl->id.numid + kctl->count - 1; }
} }
return card->last_numid; return false;
} }
static int snd_ctl_find_hole(struct snd_card *card, unsigned int count) static int snd_ctl_find_hole(struct snd_card *card, unsigned int count)
{ {
unsigned int last_numid, iter = 100000; unsigned int iter = 100000;
last_numid = card->last_numid; while (snd_ctl_remove_numid_conflict(card, count)) {
while (last_numid != snd_ctl_hole_check(card, count)) {
if (--iter == 0) { if (--iter == 0) {
/* this situation is very unlikely */ /* this situation is very unlikely */
snd_printk(KERN_ERR "unable to allocate new control numid\n"); snd_printk(KERN_ERR "unable to allocate new control numid\n");
return -ENOMEM; return -ENOMEM;
} }
last_numid = card->last_numid;
} }
return 0; return 0;
} }
......
...@@ -225,15 +225,16 @@ int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd) ...@@ -225,15 +225,16 @@ int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd)
{ {
struct snd_device *dev; struct snd_device *dev;
int err; int err;
unsigned int range_low, range_high; unsigned int range_low, range_high, type;
if (snd_BUG_ON(!card)) if (snd_BUG_ON(!card))
return -ENXIO; return -ENXIO;
range_low = cmd * SNDRV_DEV_TYPE_RANGE_SIZE; range_low = (__force unsigned int)cmd * SNDRV_DEV_TYPE_RANGE_SIZE;
range_high = range_low + SNDRV_DEV_TYPE_RANGE_SIZE - 1; range_high = range_low + SNDRV_DEV_TYPE_RANGE_SIZE - 1;
__again: __again:
list_for_each_entry(dev, &card->devices, list) { list_for_each_entry(dev, &card->devices, list) {
if (dev->type >= range_low && dev->type <= range_high) { type = (__force unsigned int)dev->type;
if (type >= range_low && type <= range_high) {
if ((err = snd_device_free(card, dev->device_data)) < 0) if ((err = snd_device_free(card, dev->device_data)) < 0)
return err; return err;
goto __again; goto __again;
......
...@@ -192,7 +192,8 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size, ...@@ -192,7 +192,8 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size,
dmab->bytes = 0; dmab->bytes = 0;
switch (type) { switch (type) {
case SNDRV_DMA_TYPE_CONTINUOUS: case SNDRV_DMA_TYPE_CONTINUOUS:
dmab->area = snd_malloc_pages(size, (unsigned long)device); dmab->area = snd_malloc_pages(size,
(__force gfp_t)(unsigned long)device);
dmab->addr = 0; dmab->addr = 0;
break; break;
#ifdef CONFIG_HAS_DMA #ifdef CONFIG_HAS_DMA
......
...@@ -114,7 +114,8 @@ static snd_pcm_sframes_t linear_transfer(struct snd_pcm_plugin *plugin, ...@@ -114,7 +114,8 @@ static snd_pcm_sframes_t linear_transfer(struct snd_pcm_plugin *plugin,
return frames; return frames;
} }
static void init_data(struct linear_priv *data, int src_format, int dst_format) static void init_data(struct linear_priv *data,
snd_pcm_format_t src_format, snd_pcm_format_t dst_format)
{ {
int src_le, dst_le, src_bytes, dst_bytes; int src_le, dst_le, src_bytes, dst_bytes;
...@@ -140,9 +141,9 @@ static void init_data(struct linear_priv *data, int src_format, int dst_format) ...@@ -140,9 +141,9 @@ static void init_data(struct linear_priv *data, int src_format, int dst_format)
if (snd_pcm_format_signed(src_format) != if (snd_pcm_format_signed(src_format) !=
snd_pcm_format_signed(dst_format)) { snd_pcm_format_signed(dst_format)) {
if (dst_le) if (dst_le)
data->flip = cpu_to_le32(0x80000000); data->flip = (__force u32)cpu_to_le32(0x80000000);
else else
data->flip = cpu_to_be32(0x80000000); data->flip = (__force u32)cpu_to_be32(0x80000000);
} }
} }
......
...@@ -190,9 +190,10 @@ static int snd_mixer_oss_get_recsrc(struct snd_mixer_oss_file *fmixer) ...@@ -190,9 +190,10 @@ static int snd_mixer_oss_get_recsrc(struct snd_mixer_oss_file *fmixer)
return -EIO; return -EIO;
if (mixer->put_recsrc && mixer->get_recsrc) { /* exclusive */ if (mixer->put_recsrc && mixer->get_recsrc) { /* exclusive */
int err; int err;
if ((err = mixer->get_recsrc(fmixer, &result)) < 0) unsigned int index;
if ((err = mixer->get_recsrc(fmixer, &index)) < 0)
return err; return err;
result = 1 << result; result = 1 << index;
} else { } else {
struct snd_mixer_oss_slot *pslot; struct snd_mixer_oss_slot *pslot;
int chn; int chn;
...@@ -214,6 +215,7 @@ static int snd_mixer_oss_set_recsrc(struct snd_mixer_oss_file *fmixer, int recsr ...@@ -214,6 +215,7 @@ static int snd_mixer_oss_set_recsrc(struct snd_mixer_oss_file *fmixer, int recsr
struct snd_mixer_oss *mixer = fmixer->mixer; struct snd_mixer_oss *mixer = fmixer->mixer;
struct snd_mixer_oss_slot *pslot; struct snd_mixer_oss_slot *pslot;
int chn, active; int chn, active;
unsigned int index;
int result = 0; int result = 0;
if (mixer == NULL) if (mixer == NULL)
...@@ -222,8 +224,8 @@ static int snd_mixer_oss_set_recsrc(struct snd_mixer_oss_file *fmixer, int recsr ...@@ -222,8 +224,8 @@ static int snd_mixer_oss_set_recsrc(struct snd_mixer_oss_file *fmixer, int recsr
if (recsrc & ~mixer->oss_recsrc) if (recsrc & ~mixer->oss_recsrc)
recsrc &= ~mixer->oss_recsrc; recsrc &= ~mixer->oss_recsrc;
mixer->put_recsrc(fmixer, ffz(~recsrc)); mixer->put_recsrc(fmixer, ffz(~recsrc));
mixer->get_recsrc(fmixer, &result); mixer->get_recsrc(fmixer, &index);
result = 1 << result; result = 1 << index;
} }
for (chn = 0; chn < 31; chn++) { for (chn = 0; chn < 31; chn++) {
pslot = &mixer->slots[chn]; pslot = &mixer->slots[chn];
......
...@@ -274,7 +274,7 @@ static snd_pcm_sframes_t mulaw_transfer(struct snd_pcm_plugin *plugin, ...@@ -274,7 +274,7 @@ static snd_pcm_sframes_t mulaw_transfer(struct snd_pcm_plugin *plugin,
return frames; return frames;
} }
static void init_data(struct mulaw_priv *data, int format) static void init_data(struct mulaw_priv *data, snd_pcm_format_t format)
{ {
#ifdef SNDRV_LITTLE_ENDIAN #ifdef SNDRV_LITTLE_ENDIAN
data->cvt_endian = snd_pcm_format_big_endian(format) > 0; data->cvt_endian = snd_pcm_format_big_endian(format) > 0;
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <sound/info.h> #include <sound/info.h>
#include <linux/soundcard.h> #include <linux/soundcard.h>
#include <sound/initval.h> #include <sound/initval.h>
#include <sound/mixer_oss.h>
#define OSS_ALSAEMULVER _SIOR ('M', 249, int) #define OSS_ALSAEMULVER _SIOR ('M', 249, int)
...@@ -60,7 +61,6 @@ MODULE_PARM_DESC(nonblock_open, "Don't block opening busy PCM devices."); ...@@ -60,7 +61,6 @@ MODULE_PARM_DESC(nonblock_open, "Don't block opening busy PCM devices.");
MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_PCM); MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_PCM);
MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_PCM1); MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_PCM1);
extern int snd_mixer_oss_ioctl_card(struct snd_card *card, unsigned int cmd, unsigned long arg);
static int snd_pcm_oss_get_rate(struct snd_pcm_oss_file *pcm_oss_file); static int snd_pcm_oss_get_rate(struct snd_pcm_oss_file *pcm_oss_file);
static int snd_pcm_oss_get_channels(struct snd_pcm_oss_file *pcm_oss_file); static int snd_pcm_oss_get_channels(struct snd_pcm_oss_file *pcm_oss_file);
static int snd_pcm_oss_get_format(struct snd_pcm_oss_file *pcm_oss_file); static int snd_pcm_oss_get_format(struct snd_pcm_oss_file *pcm_oss_file);
...@@ -656,7 +656,7 @@ snd_pcm_uframes_t get_hw_ptr_period(struct snd_pcm_runtime *runtime) ...@@ -656,7 +656,7 @@ snd_pcm_uframes_t get_hw_ptr_period(struct snd_pcm_runtime *runtime)
#define AFMT_AC3 0x00000400 #define AFMT_AC3 0x00000400
#define AFMT_VORBIS 0x00000800 #define AFMT_VORBIS 0x00000800
static int snd_pcm_oss_format_from(int format) static snd_pcm_format_t snd_pcm_oss_format_from(int format)
{ {
switch (format) { switch (format) {
case AFMT_MU_LAW: return SNDRV_PCM_FORMAT_MU_LAW; case AFMT_MU_LAW: return SNDRV_PCM_FORMAT_MU_LAW;
...@@ -680,7 +680,7 @@ static int snd_pcm_oss_format_from(int format) ...@@ -680,7 +680,7 @@ static int snd_pcm_oss_format_from(int format)
} }
} }
static int snd_pcm_oss_format_to(int format) static int snd_pcm_oss_format_to(snd_pcm_format_t format)
{ {
switch (format) { switch (format) {
case SNDRV_PCM_FORMAT_MU_LAW: return AFMT_MU_LAW; case SNDRV_PCM_FORMAT_MU_LAW: return AFMT_MU_LAW;
...@@ -843,7 +843,8 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream) ...@@ -843,7 +843,8 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
size_t oss_frame_size; size_t oss_frame_size;
int err; int err;
int direct; int direct;
int format, sformat, n; snd_pcm_format_t format, sformat;
int n;
struct snd_mask sformat_mask; struct snd_mask sformat_mask;
struct snd_mask mask; struct snd_mask mask;
...@@ -868,11 +869,11 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream) ...@@ -868,11 +869,11 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
_snd_pcm_hw_param_min(sparams, SNDRV_PCM_HW_PARAM_PERIODS, 2, 0); _snd_pcm_hw_param_min(sparams, SNDRV_PCM_HW_PARAM_PERIODS, 2, 0);
snd_mask_none(&mask); snd_mask_none(&mask);
if (atomic_read(&substream->mmap_count)) if (atomic_read(&substream->mmap_count))
snd_mask_set(&mask, SNDRV_PCM_ACCESS_MMAP_INTERLEAVED); snd_mask_set(&mask, (__force int)SNDRV_PCM_ACCESS_MMAP_INTERLEAVED);
else { else {
snd_mask_set(&mask, SNDRV_PCM_ACCESS_RW_INTERLEAVED); snd_mask_set(&mask, (__force int)SNDRV_PCM_ACCESS_RW_INTERLEAVED);
if (!direct) if (!direct)
snd_mask_set(&mask, SNDRV_PCM_ACCESS_RW_NONINTERLEAVED); snd_mask_set(&mask, (__force int)SNDRV_PCM_ACCESS_RW_NONINTERLEAVED);
} }
err = snd_pcm_hw_param_mask(substream, sparams, SNDRV_PCM_HW_PARAM_ACCESS, &mask); err = snd_pcm_hw_param_mask(substream, sparams, SNDRV_PCM_HW_PARAM_ACCESS, &mask);
if (err < 0) { if (err < 0) {
...@@ -891,19 +892,22 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream) ...@@ -891,19 +892,22 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
else else
sformat = snd_pcm_plug_slave_format(format, &sformat_mask); sformat = snd_pcm_plug_slave_format(format, &sformat_mask);
if (sformat < 0 || !snd_mask_test(&sformat_mask, sformat)) { if ((__force int)sformat < 0 ||
for (sformat = 0; sformat <= SNDRV_PCM_FORMAT_LAST; sformat++) { !snd_mask_test(&sformat_mask, (__force int)sformat)) {
if (snd_mask_test(&sformat_mask, sformat) && for (sformat = (__force snd_pcm_format_t)0;
(__force int)sformat <= (__force int)SNDRV_PCM_FORMAT_LAST;
sformat = (__force snd_pcm_format_t)((__force int)sformat + 1)) {
if (snd_mask_test(&sformat_mask, (__force int)sformat) &&
snd_pcm_oss_format_to(sformat) >= 0) snd_pcm_oss_format_to(sformat) >= 0)
break; break;
} }
if (sformat > SNDRV_PCM_FORMAT_LAST) { if ((__force int)sformat > (__force int)SNDRV_PCM_FORMAT_LAST) {
snd_printd("Cannot find a format!!!\n"); snd_printd("Cannot find a format!!!\n");
err = -EINVAL; err = -EINVAL;
goto failure; goto failure;
} }
} }
err = _snd_pcm_hw_param_set(sparams, SNDRV_PCM_HW_PARAM_FORMAT, sformat, 0); err = _snd_pcm_hw_param_set(sparams, SNDRV_PCM_HW_PARAM_FORMAT, (__force int)sformat, 0);
if (err < 0) if (err < 0)
goto failure; goto failure;
...@@ -912,9 +916,9 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream) ...@@ -912,9 +916,9 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
} else { } else {
_snd_pcm_hw_params_any(params); _snd_pcm_hw_params_any(params);
_snd_pcm_hw_param_set(params, SNDRV_PCM_HW_PARAM_ACCESS, _snd_pcm_hw_param_set(params, SNDRV_PCM_HW_PARAM_ACCESS,
SNDRV_PCM_ACCESS_RW_INTERLEAVED, 0); (__force int)SNDRV_PCM_ACCESS_RW_INTERLEAVED, 0);
_snd_pcm_hw_param_set(params, SNDRV_PCM_HW_PARAM_FORMAT, _snd_pcm_hw_param_set(params, SNDRV_PCM_HW_PARAM_FORMAT,
snd_pcm_oss_format_from(runtime->oss.format), 0); (__force int)snd_pcm_oss_format_from(runtime->oss.format), 0);
_snd_pcm_hw_param_set(params, SNDRV_PCM_HW_PARAM_CHANNELS, _snd_pcm_hw_param_set(params, SNDRV_PCM_HW_PARAM_CHANNELS,
runtime->oss.channels, 0); runtime->oss.channels, 0);
_snd_pcm_hw_param_set(params, SNDRV_PCM_HW_PARAM_RATE, _snd_pcm_hw_param_set(params, SNDRV_PCM_HW_PARAM_RATE,
...@@ -1185,10 +1189,10 @@ snd_pcm_sframes_t snd_pcm_oss_write3(struct snd_pcm_substream *substream, const ...@@ -1185,10 +1189,10 @@ snd_pcm_sframes_t snd_pcm_oss_write3(struct snd_pcm_substream *substream, const
if (in_kernel) { if (in_kernel) {
mm_segment_t fs; mm_segment_t fs;
fs = snd_enter_user(); fs = snd_enter_user();
ret = snd_pcm_lib_write(substream, (void __user *)ptr, frames); ret = snd_pcm_lib_write(substream, (void __force __user *)ptr, frames);
snd_leave_user(fs); snd_leave_user(fs);
} else { } else {
ret = snd_pcm_lib_write(substream, (void __user *)ptr, frames); ret = snd_pcm_lib_write(substream, (void __force __user *)ptr, frames);
} }
if (ret != -EPIPE && ret != -ESTRPIPE) if (ret != -EPIPE && ret != -ESTRPIPE)
break; break;
...@@ -1230,10 +1234,10 @@ snd_pcm_sframes_t snd_pcm_oss_read3(struct snd_pcm_substream *substream, char *p ...@@ -1230,10 +1234,10 @@ snd_pcm_sframes_t snd_pcm_oss_read3(struct snd_pcm_substream *substream, char *p
if (in_kernel) { if (in_kernel) {
mm_segment_t fs; mm_segment_t fs;
fs = snd_enter_user(); fs = snd_enter_user();
ret = snd_pcm_lib_read(substream, (void __user *)ptr, frames); ret = snd_pcm_lib_read(substream, (void __force __user *)ptr, frames);
snd_leave_user(fs); snd_leave_user(fs);
} else { } else {
ret = snd_pcm_lib_read(substream, (void __user *)ptr, frames); ret = snd_pcm_lib_read(substream, (void __force __user *)ptr, frames);
} }
if (ret == -EPIPE) { if (ret == -EPIPE) {
if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) {
...@@ -1333,7 +1337,7 @@ static ssize_t snd_pcm_oss_write2(struct snd_pcm_substream *substream, const cha ...@@ -1333,7 +1337,7 @@ static ssize_t snd_pcm_oss_write2(struct snd_pcm_substream *substream, const cha
struct snd_pcm_plugin_channel *channels; struct snd_pcm_plugin_channel *channels;
size_t oss_frame_bytes = (runtime->oss.plugin_first->src_width * runtime->oss.plugin_first->src_format.channels) / 8; size_t oss_frame_bytes = (runtime->oss.plugin_first->src_width * runtime->oss.plugin_first->src_format.channels) / 8;
if (!in_kernel) { if (!in_kernel) {
if (copy_from_user(runtime->oss.buffer, (const char __user *)buf, bytes)) if (copy_from_user(runtime->oss.buffer, (const char __force __user *)buf, bytes))
return -EFAULT; return -EFAULT;
buf = runtime->oss.buffer; buf = runtime->oss.buffer;
} }
...@@ -1429,7 +1433,7 @@ static ssize_t snd_pcm_oss_read2(struct snd_pcm_substream *substream, char *buf, ...@@ -1429,7 +1433,7 @@ static ssize_t snd_pcm_oss_read2(struct snd_pcm_substream *substream, char *buf,
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_sframes_t frames, frames1; snd_pcm_sframes_t frames, frames1;
#ifdef CONFIG_SND_PCM_OSS_PLUGINS #ifdef CONFIG_SND_PCM_OSS_PLUGINS
char __user *final_dst = (char __user *)buf; char __user *final_dst = (char __force __user *)buf;
if (runtime->oss.plugin_first) { if (runtime->oss.plugin_first) {
struct snd_pcm_plugin_channel *channels; struct snd_pcm_plugin_channel *channels;
size_t oss_frame_bytes = (runtime->oss.plugin_last->dst_width * runtime->oss.plugin_last->dst_format.channels) / 8; size_t oss_frame_bytes = (runtime->oss.plugin_last->dst_width * runtime->oss.plugin_last->dst_format.channels) / 8;
...@@ -1549,6 +1553,7 @@ static int snd_pcm_oss_sync1(struct snd_pcm_substream *substream, size_t size) ...@@ -1549,6 +1553,7 @@ static int snd_pcm_oss_sync1(struct snd_pcm_substream *substream, size_t size)
{ {
struct snd_pcm_runtime *runtime; struct snd_pcm_runtime *runtime;
ssize_t result = 0; ssize_t result = 0;
snd_pcm_state_t state;
long res; long res;
wait_queue_t wait; wait_queue_t wait;
...@@ -1570,9 +1575,9 @@ static int snd_pcm_oss_sync1(struct snd_pcm_substream *substream, size_t size) ...@@ -1570,9 +1575,9 @@ static int snd_pcm_oss_sync1(struct snd_pcm_substream *substream, size_t size)
result = 0; result = 0;
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
snd_pcm_stream_lock_irq(substream); snd_pcm_stream_lock_irq(substream);
res = runtime->status->state; state = runtime->status->state;
snd_pcm_stream_unlock_irq(substream); snd_pcm_stream_unlock_irq(substream);
if (res != SNDRV_PCM_STATE_RUNNING) { if (state != SNDRV_PCM_STATE_RUNNING) {
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
break; break;
} }
...@@ -1658,7 +1663,7 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file) ...@@ -1658,7 +1663,7 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
size1); size1);
size1 /= runtime->channels; /* frames */ size1 /= runtime->channels; /* frames */
fs = snd_enter_user(); fs = snd_enter_user();
snd_pcm_lib_write(substream, (void __user *)runtime->oss.buffer, size1); snd_pcm_lib_write(substream, (void __force __user *)runtime->oss.buffer, size1);
snd_leave_user(fs); snd_leave_user(fs);
} }
} else if (runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) { } else if (runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) {
......
...@@ -264,7 +264,7 @@ snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *plug, snd_pc ...@@ -264,7 +264,7 @@ snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *plug, snd_pc
return frames; return frames;
} }
static int snd_pcm_plug_formats(struct snd_mask *mask, int format) static int snd_pcm_plug_formats(struct snd_mask *mask, snd_pcm_format_t format)
{ {
struct snd_mask formats = *mask; struct snd_mask formats = *mask;
u64 linfmts = (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S8 | u64 linfmts = (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S8 |
...@@ -276,16 +276,16 @@ static int snd_pcm_plug_formats(struct snd_mask *mask, int format) ...@@ -276,16 +276,16 @@ static int snd_pcm_plug_formats(struct snd_mask *mask, int format)
SNDRV_PCM_FMTBIT_U24_3BE | SNDRV_PCM_FMTBIT_S24_3BE | SNDRV_PCM_FMTBIT_U24_3BE | SNDRV_PCM_FMTBIT_S24_3BE |
SNDRV_PCM_FMTBIT_U32_LE | SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_U32_LE | SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_U32_BE | SNDRV_PCM_FMTBIT_S32_BE); SNDRV_PCM_FMTBIT_U32_BE | SNDRV_PCM_FMTBIT_S32_BE);
snd_mask_set(&formats, SNDRV_PCM_FORMAT_MU_LAW); snd_mask_set(&formats, (__force int)SNDRV_PCM_FORMAT_MU_LAW);
if (formats.bits[0] & (u32)linfmts) if (formats.bits[0] & (u32)linfmts)
formats.bits[0] |= (u32)linfmts; formats.bits[0] |= (u32)linfmts;
if (formats.bits[1] & (u32)(linfmts >> 32)) if (formats.bits[1] & (u32)(linfmts >> 32))
formats.bits[1] |= (u32)(linfmts >> 32); formats.bits[1] |= (u32)(linfmts >> 32);
return snd_mask_test(&formats, format); return snd_mask_test(&formats, (__force int)format);
} }
static int preferred_formats[] = { static snd_pcm_format_t preferred_formats[] = {
SNDRV_PCM_FORMAT_S16_LE, SNDRV_PCM_FORMAT_S16_LE,
SNDRV_PCM_FORMAT_S16_BE, SNDRV_PCM_FORMAT_S16_BE,
SNDRV_PCM_FORMAT_U16_LE, SNDRV_PCM_FORMAT_U16_LE,
...@@ -306,24 +306,25 @@ static int preferred_formats[] = { ...@@ -306,24 +306,25 @@ static int preferred_formats[] = {
SNDRV_PCM_FORMAT_U8 SNDRV_PCM_FORMAT_U8
}; };
int snd_pcm_plug_slave_format(int format, struct snd_mask *format_mask) snd_pcm_format_t snd_pcm_plug_slave_format(snd_pcm_format_t format,
struct snd_mask *format_mask)
{ {
int i; int i;
if (snd_mask_test(format_mask, format)) if (snd_mask_test(format_mask, (__force int)format))
return format; return format;
if (! snd_pcm_plug_formats(format_mask, format)) if (!snd_pcm_plug_formats(format_mask, format))
return -EINVAL; return (__force snd_pcm_format_t)-EINVAL;
if (snd_pcm_format_linear(format)) { if (snd_pcm_format_linear(format)) {
unsigned int width = snd_pcm_format_width(format); unsigned int width = snd_pcm_format_width(format);
int unsignd = snd_pcm_format_unsigned(format) > 0; int unsignd = snd_pcm_format_unsigned(format) > 0;
int big = snd_pcm_format_big_endian(format) > 0; int big = snd_pcm_format_big_endian(format) > 0;
unsigned int badness, best = -1; unsigned int badness, best = -1;
int best_format = -1; snd_pcm_format_t best_format = (__force snd_pcm_format_t)-1;
for (i = 0; i < ARRAY_SIZE(preferred_formats); i++) { for (i = 0; i < ARRAY_SIZE(preferred_formats); i++) {
int f = preferred_formats[i]; snd_pcm_format_t f = preferred_formats[i];
unsigned int w; unsigned int w;
if (!snd_mask_test(format_mask, f)) if (!snd_mask_test(format_mask, (__force int)f))
continue; continue;
w = snd_pcm_format_width(f); w = snd_pcm_format_width(f);
if (w >= width) if (w >= width)
...@@ -337,17 +338,20 @@ int snd_pcm_plug_slave_format(int format, struct snd_mask *format_mask) ...@@ -337,17 +338,20 @@ int snd_pcm_plug_slave_format(int format, struct snd_mask *format_mask)
best = badness; best = badness;
} }
} }
return best_format >= 0 ? best_format : -EINVAL; if ((__force int)best_format >= 0)
return best_format;
else
return (__force snd_pcm_format_t)-EINVAL;
} else { } else {
switch (format) { switch (format) {
case SNDRV_PCM_FORMAT_MU_LAW: case SNDRV_PCM_FORMAT_MU_LAW:
for (i = 0; i < ARRAY_SIZE(preferred_formats); ++i) { for (i = 0; i < ARRAY_SIZE(preferred_formats); ++i) {
int format1 = preferred_formats[i]; snd_pcm_format_t format1 = preferred_formats[i];
if (snd_mask_test(format_mask, format1)) if (snd_mask_test(format_mask, (__force int)format1))
return format1; return format1;
} }
default: default:
return -EINVAL; return (__force snd_pcm_format_t)-EINVAL;
} }
} }
} }
...@@ -359,7 +363,7 @@ int snd_pcm_plug_format_plugins(struct snd_pcm_substream *plug, ...@@ -359,7 +363,7 @@ int snd_pcm_plug_format_plugins(struct snd_pcm_substream *plug,
struct snd_pcm_plugin_format tmpformat; struct snd_pcm_plugin_format tmpformat;
struct snd_pcm_plugin_format dstformat; struct snd_pcm_plugin_format dstformat;
struct snd_pcm_plugin_format srcformat; struct snd_pcm_plugin_format srcformat;
int src_access, dst_access; snd_pcm_access_t src_access, dst_access;
struct snd_pcm_plugin *plugin = NULL; struct snd_pcm_plugin *plugin = NULL;
int err; int err;
int stream = snd_pcm_plug_stream(plug); int stream = snd_pcm_plug_stream(plug);
...@@ -641,7 +645,7 @@ snd_pcm_sframes_t snd_pcm_plug_read_transfer(struct snd_pcm_substream *plug, str ...@@ -641,7 +645,7 @@ snd_pcm_sframes_t snd_pcm_plug_read_transfer(struct snd_pcm_substream *plug, str
} }
int snd_pcm_area_silence(const struct snd_pcm_channel_area *dst_area, size_t dst_offset, int snd_pcm_area_silence(const struct snd_pcm_channel_area *dst_area, size_t dst_offset,
size_t samples, int format) size_t samples, snd_pcm_format_t format)
{ {
/* FIXME: sub byte resolution and odd dst_offset */ /* FIXME: sub byte resolution and odd dst_offset */
unsigned char *dst; unsigned char *dst;
...@@ -688,7 +692,7 @@ int snd_pcm_area_silence(const struct snd_pcm_channel_area *dst_area, size_t dst ...@@ -688,7 +692,7 @@ int snd_pcm_area_silence(const struct snd_pcm_channel_area *dst_area, size_t dst
int snd_pcm_area_copy(const struct snd_pcm_channel_area *src_area, size_t src_offset, int snd_pcm_area_copy(const struct snd_pcm_channel_area *src_area, size_t src_offset,
const struct snd_pcm_channel_area *dst_area, size_t dst_offset, const struct snd_pcm_channel_area *dst_area, size_t dst_offset,
size_t samples, int format) size_t samples, snd_pcm_format_t format)
{ {
/* FIXME: sub byte resolution and odd dst_offset */ /* FIXME: sub byte resolution and odd dst_offset */
char *src, *dst; char *src, *dst;
......
...@@ -46,7 +46,7 @@ struct snd_pcm_plugin_channel { ...@@ -46,7 +46,7 @@ struct snd_pcm_plugin_channel {
}; };
struct snd_pcm_plugin_format { struct snd_pcm_plugin_format {
int format; snd_pcm_format_t format;
unsigned int rate; unsigned int rate;
unsigned int channels; unsigned int channels;
}; };
...@@ -58,7 +58,7 @@ struct snd_pcm_plugin { ...@@ -58,7 +58,7 @@ struct snd_pcm_plugin {
struct snd_pcm_plugin_format dst_format; /* destination format */ struct snd_pcm_plugin_format dst_format; /* destination format */
int src_width; /* sample width in bits */ int src_width; /* sample width in bits */
int dst_width; /* sample width in bits */ int dst_width; /* sample width in bits */
int access; snd_pcm_access_t access;
snd_pcm_sframes_t (*src_frames)(struct snd_pcm_plugin *plugin, snd_pcm_uframes_t dst_frames); snd_pcm_sframes_t (*src_frames)(struct snd_pcm_plugin *plugin, snd_pcm_uframes_t dst_frames);
snd_pcm_sframes_t (*dst_frames)(struct snd_pcm_plugin *plugin, snd_pcm_uframes_t src_frames); snd_pcm_sframes_t (*dst_frames)(struct snd_pcm_plugin *plugin, snd_pcm_uframes_t src_frames);
snd_pcm_sframes_t (*client_channels)(struct snd_pcm_plugin *plugin, snd_pcm_sframes_t (*client_channels)(struct snd_pcm_plugin *plugin,
...@@ -125,7 +125,8 @@ int snd_pcm_plug_format_plugins(struct snd_pcm_substream *substream, ...@@ -125,7 +125,8 @@ int snd_pcm_plug_format_plugins(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_pcm_hw_params *params,
struct snd_pcm_hw_params *slave_params); struct snd_pcm_hw_params *slave_params);
int snd_pcm_plug_slave_format(int format, struct snd_mask *format_mask); snd_pcm_format_t snd_pcm_plug_slave_format(snd_pcm_format_t format,
struct snd_mask *format_mask);
int snd_pcm_plugin_append(struct snd_pcm_plugin *plugin); int snd_pcm_plugin_append(struct snd_pcm_plugin *plugin);
...@@ -146,12 +147,12 @@ snd_pcm_sframes_t snd_pcm_plugin_client_channels(struct snd_pcm_plugin *plugin, ...@@ -146,12 +147,12 @@ snd_pcm_sframes_t snd_pcm_plugin_client_channels(struct snd_pcm_plugin *plugin,
int snd_pcm_area_silence(const struct snd_pcm_channel_area *dst_channel, int snd_pcm_area_silence(const struct snd_pcm_channel_area *dst_channel,
size_t dst_offset, size_t dst_offset,
size_t samples, int format); size_t samples, snd_pcm_format_t format);
int snd_pcm_area_copy(const struct snd_pcm_channel_area *src_channel, int snd_pcm_area_copy(const struct snd_pcm_channel_area *src_channel,
size_t src_offset, size_t src_offset,
const struct snd_pcm_channel_area *dst_channel, const struct snd_pcm_channel_area *dst_channel,
size_t dst_offset, size_t dst_offset,
size_t samples, int format); size_t samples, snd_pcm_format_t format);
void *snd_pcm_plug_buf_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t size); void *snd_pcm_plug_buf_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t size);
void snd_pcm_plug_buf_unlock(struct snd_pcm_substream *plug, void *ptr); void snd_pcm_plug_buf_unlock(struct snd_pcm_substream *plug, void *ptr);
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "pcm_plugin.h" #include "pcm_plugin.h"
static void zero_areas(struct snd_pcm_plugin_channel *dvp, int ndsts, static void zero_areas(struct snd_pcm_plugin_channel *dvp, int ndsts,
snd_pcm_uframes_t frames, int format) snd_pcm_uframes_t frames, snd_pcm_format_t format)
{ {
int dst = 0; int dst = 0;
for (; dst < ndsts; ++dst) { for (; dst < ndsts; ++dst) {
...@@ -38,7 +38,7 @@ static void zero_areas(struct snd_pcm_plugin_channel *dvp, int ndsts, ...@@ -38,7 +38,7 @@ static void zero_areas(struct snd_pcm_plugin_channel *dvp, int ndsts,
static inline void copy_area(const struct snd_pcm_plugin_channel *src_channel, static inline void copy_area(const struct snd_pcm_plugin_channel *src_channel,
struct snd_pcm_plugin_channel *dst_channel, struct snd_pcm_plugin_channel *dst_channel,
snd_pcm_uframes_t frames, int format) snd_pcm_uframes_t frames, snd_pcm_format_t format)
{ {
dst_channel->enabled = 1; dst_channel->enabled = 1;
snd_pcm_area_copy(&src_channel->area, 0, &dst_channel->area, 0, frames, format); snd_pcm_area_copy(&src_channel->area, 0, &dst_channel->area, 0, frames, format);
...@@ -51,7 +51,7 @@ static snd_pcm_sframes_t route_transfer(struct snd_pcm_plugin *plugin, ...@@ -51,7 +51,7 @@ static snd_pcm_sframes_t route_transfer(struct snd_pcm_plugin *plugin,
{ {
int nsrcs, ndsts, dst; int nsrcs, ndsts, dst;
struct snd_pcm_plugin_channel *dvp; struct snd_pcm_plugin_channel *dvp;
int format; snd_pcm_format_t format;
if (snd_BUG_ON(!plugin || !src_channels || !dst_channels)) if (snd_BUG_ON(!plugin || !src_channels || !dst_channels))
return -ENXIO; return -ENXIO;
......
...@@ -211,9 +211,9 @@ static char *snd_pcm_format_names[] = { ...@@ -211,9 +211,9 @@ static char *snd_pcm_format_names[] = {
const char *snd_pcm_format_name(snd_pcm_format_t format) const char *snd_pcm_format_name(snd_pcm_format_t format)
{ {
if (format >= ARRAY_SIZE(snd_pcm_format_names)) if ((__force unsigned int)format >= ARRAY_SIZE(snd_pcm_format_names))
return "Unknown"; return "Unknown";
return snd_pcm_format_names[format]; return snd_pcm_format_names[(__force unsigned int)format];
} }
EXPORT_SYMBOL_GPL(snd_pcm_format_name); EXPORT_SYMBOL_GPL(snd_pcm_format_name);
...@@ -269,12 +269,12 @@ static const char *snd_pcm_stream_name(int stream) ...@@ -269,12 +269,12 @@ static const char *snd_pcm_stream_name(int stream)
static const char *snd_pcm_access_name(snd_pcm_access_t access) static const char *snd_pcm_access_name(snd_pcm_access_t access)
{ {
return snd_pcm_access_names[access]; return snd_pcm_access_names[(__force int)access];
} }
static const char *snd_pcm_subformat_name(snd_pcm_subformat_t subformat) static const char *snd_pcm_subformat_name(snd_pcm_subformat_t subformat)
{ {
return snd_pcm_subformat_names[subformat]; return snd_pcm_subformat_names[(__force int)subformat];
} }
static const char *snd_pcm_tstamp_mode_name(int mode) static const char *snd_pcm_tstamp_mode_name(int mode)
...@@ -284,7 +284,7 @@ static const char *snd_pcm_tstamp_mode_name(int mode) ...@@ -284,7 +284,7 @@ static const char *snd_pcm_tstamp_mode_name(int mode)
static const char *snd_pcm_state_name(snd_pcm_state_t state) static const char *snd_pcm_state_name(snd_pcm_state_t state)
{ {
return snd_pcm_state_names[state]; return snd_pcm_state_names[(__force int)state];
} }
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
......
...@@ -35,7 +35,10 @@ struct pcm_format_data { ...@@ -35,7 +35,10 @@ struct pcm_format_data {
unsigned char silence[8]; /* silence data to fill */ unsigned char silence[8]; /* silence data to fill */
}; };
static struct pcm_format_data pcm_formats[SNDRV_PCM_FORMAT_LAST+1] = { /* we do lots of calculations on snd_pcm_format_t; shut up sparse */
#define INT __force int
static struct pcm_format_data pcm_formats[(INT)SNDRV_PCM_FORMAT_LAST+1] = {
[SNDRV_PCM_FORMAT_S8] = { [SNDRV_PCM_FORMAT_S8] = {
.width = 8, .phys = 8, .le = -1, .signd = 1, .width = 8, .phys = 8, .le = -1, .signd = 1,
.silence = {}, .silence = {},
...@@ -215,9 +218,9 @@ static struct pcm_format_data pcm_formats[SNDRV_PCM_FORMAT_LAST+1] = { ...@@ -215,9 +218,9 @@ static struct pcm_format_data pcm_formats[SNDRV_PCM_FORMAT_LAST+1] = {
int snd_pcm_format_signed(snd_pcm_format_t format) int snd_pcm_format_signed(snd_pcm_format_t format)
{ {
int val; int val;
if (format < 0 || format > SNDRV_PCM_FORMAT_LAST) if ((INT)format < 0 || (INT)format > (INT)SNDRV_PCM_FORMAT_LAST)
return -EINVAL; return -EINVAL;
if ((val = pcm_formats[format].signd) < 0) if ((val = pcm_formats[(INT)format].signd) < 0)
return -EINVAL; return -EINVAL;
return val; return val;
} }
...@@ -266,9 +269,9 @@ EXPORT_SYMBOL(snd_pcm_format_linear); ...@@ -266,9 +269,9 @@ EXPORT_SYMBOL(snd_pcm_format_linear);
int snd_pcm_format_little_endian(snd_pcm_format_t format) int snd_pcm_format_little_endian(snd_pcm_format_t format)
{ {
int val; int val;
if (format < 0 || format > SNDRV_PCM_FORMAT_LAST) if ((INT)format < 0 || (INT)format > (INT)SNDRV_PCM_FORMAT_LAST)
return -EINVAL; return -EINVAL;
if ((val = pcm_formats[format].le) < 0) if ((val = pcm_formats[(INT)format].le) < 0)
return -EINVAL; return -EINVAL;
return val; return val;
} }
...@@ -304,9 +307,9 @@ EXPORT_SYMBOL(snd_pcm_format_big_endian); ...@@ -304,9 +307,9 @@ EXPORT_SYMBOL(snd_pcm_format_big_endian);
int snd_pcm_format_width(snd_pcm_format_t format) int snd_pcm_format_width(snd_pcm_format_t format)
{ {
int val; int val;
if (format < 0 || format > SNDRV_PCM_FORMAT_LAST) if ((INT)format < 0 || (INT)format > (INT)SNDRV_PCM_FORMAT_LAST)
return -EINVAL; return -EINVAL;
if ((val = pcm_formats[format].width) == 0) if ((val = pcm_formats[(INT)format].width) == 0)
return -EINVAL; return -EINVAL;
return val; return val;
} }
...@@ -323,9 +326,9 @@ EXPORT_SYMBOL(snd_pcm_format_width); ...@@ -323,9 +326,9 @@ EXPORT_SYMBOL(snd_pcm_format_width);
int snd_pcm_format_physical_width(snd_pcm_format_t format) int snd_pcm_format_physical_width(snd_pcm_format_t format)
{ {
int val; int val;
if (format < 0 || format > SNDRV_PCM_FORMAT_LAST) if ((INT)format < 0 || (INT)format > (INT)SNDRV_PCM_FORMAT_LAST)
return -EINVAL; return -EINVAL;
if ((val = pcm_formats[format].phys) == 0) if ((val = pcm_formats[(INT)format].phys) == 0)
return -EINVAL; return -EINVAL;
return val; return val;
} }
...@@ -358,11 +361,11 @@ EXPORT_SYMBOL(snd_pcm_format_size); ...@@ -358,11 +361,11 @@ EXPORT_SYMBOL(snd_pcm_format_size);
*/ */
const unsigned char *snd_pcm_format_silence_64(snd_pcm_format_t format) const unsigned char *snd_pcm_format_silence_64(snd_pcm_format_t format)
{ {
if (format < 0 || format > SNDRV_PCM_FORMAT_LAST) if ((INT)format < 0 || (INT)format > (INT)SNDRV_PCM_FORMAT_LAST)
return NULL; return NULL;
if (! pcm_formats[format].phys) if (! pcm_formats[(INT)format].phys)
return NULL; return NULL;
return pcm_formats[format].silence; return pcm_formats[(INT)format].silence;
} }
EXPORT_SYMBOL(snd_pcm_format_silence_64); EXPORT_SYMBOL(snd_pcm_format_silence_64);
...@@ -382,16 +385,16 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int ...@@ -382,16 +385,16 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
int width; int width;
unsigned char *dst, *pat; unsigned char *dst, *pat;
if (format < 0 || format > SNDRV_PCM_FORMAT_LAST) if ((INT)format < 0 || (INT)format > (INT)SNDRV_PCM_FORMAT_LAST)
return -EINVAL; return -EINVAL;
if (samples == 0) if (samples == 0)
return 0; return 0;
width = pcm_formats[format].phys; /* physical width */ width = pcm_formats[(INT)format].phys; /* physical width */
pat = pcm_formats[format].silence; pat = pcm_formats[(INT)format].silence;
if (! width) if (! width)
return -EINVAL; return -EINVAL;
/* signed or 1 byte data */ /* signed or 1 byte data */
if (pcm_formats[format].signd == 1 || width <= 8) { if (pcm_formats[(INT)format].signd == 1 || width <= 8) {
unsigned int bytes = samples * width / 8; unsigned int bytes = samples * width / 8;
memset(data, *pat, bytes); memset(data, *pat, bytes);
return 0; return 0;
......
...@@ -941,7 +941,7 @@ static struct action_ops snd_pcm_action_stop = { ...@@ -941,7 +941,7 @@ static struct action_ops snd_pcm_action_stop = {
* *
* The state of each stream is then changed to the given state unconditionally. * The state of each stream is then changed to the given state unconditionally.
*/ */
int snd_pcm_stop(struct snd_pcm_substream *substream, int state) int snd_pcm_stop(struct snd_pcm_substream *substream, snd_pcm_state_t state)
{ {
return snd_pcm_action(&snd_pcm_action_stop, substream, state); return snd_pcm_action(&snd_pcm_action_stop, substream, state);
} }
......
...@@ -1052,7 +1052,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, ...@@ -1052,7 +1052,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf,
} else { } else {
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
if (client->convert32 && snd_seq_ev_is_varusr(&event)) { if (client->convert32 && snd_seq_ev_is_varusr(&event)) {
void *ptr = compat_ptr(event.data.raw32.d[1]); void *ptr = (void __force *)compat_ptr(event.data.raw32.d[1]);
event.data.ext.ptr = ptr; event.data.ext.ptr = ptr;
} }
#endif #endif
...@@ -2407,7 +2407,7 @@ int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg) ...@@ -2407,7 +2407,7 @@ int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg)
if (client == NULL) if (client == NULL)
return -ENXIO; return -ENXIO;
fs = snd_enter_user(); fs = snd_enter_user();
result = snd_seq_do_ioctl(client, cmd, (void __user *)arg); result = snd_seq_do_ioctl(client, cmd, (void __force __user *)arg);
snd_leave_user(fs); snd_leave_user(fs);
return result; return result;
} }
...@@ -2497,9 +2497,6 @@ static void snd_seq_info_dump_ports(struct snd_info_buffer *buffer, ...@@ -2497,9 +2497,6 @@ static void snd_seq_info_dump_ports(struct snd_info_buffer *buffer,
} }
void snd_seq_info_pool(struct snd_info_buffer *buffer,
struct snd_seq_pool *pool, char *space);
/* exported to seq_info.c */ /* exported to seq_info.c */
void snd_seq_info_clients_read(struct snd_info_entry *entry, void snd_seq_info_clients_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer) struct snd_info_buffer *buffer)
......
...@@ -86,7 +86,7 @@ int snd_seq_dump_var_event(const struct snd_seq_event *event, ...@@ -86,7 +86,7 @@ int snd_seq_dump_var_event(const struct snd_seq_event *event,
if (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR) { if (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR) {
char buf[32]; char buf[32];
char __user *curptr = (char __user *)event->data.ext.ptr; char __user *curptr = (char __force __user *)event->data.ext.ptr;
while (len > 0) { while (len > 0) {
int size = sizeof(buf); int size = sizeof(buf);
if (len < size) if (len < size)
...@@ -157,7 +157,7 @@ int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char ...@@ -157,7 +157,7 @@ int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char
if (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR) { if (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR) {
if (! in_kernel) if (! in_kernel)
return -EINVAL; return -EINVAL;
if (copy_from_user(buf, (void __user *)event->data.ext.ptr, len)) if (copy_from_user(buf, (void __force __user *)event->data.ext.ptr, len))
return -EFAULT; return -EFAULT;
return newlen; return newlen;
} }
...@@ -343,7 +343,7 @@ int snd_seq_event_dup(struct snd_seq_pool *pool, struct snd_seq_event *event, ...@@ -343,7 +343,7 @@ int snd_seq_event_dup(struct snd_seq_pool *pool, struct snd_seq_event *event,
tmp->event = src->event; tmp->event = src->event;
src = src->next; src = src->next;
} else if (is_usrptr) { } else if (is_usrptr) {
if (copy_from_user(&tmp->event, (char __user *)buf, size)) { if (copy_from_user(&tmp->event, (char __force __user *)buf, size)) {
err = -EFAULT; err = -EFAULT;
goto __error; goto __error;
} }
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include <sound/seq_kernel.h> #include <sound/seq_kernel.h>
#include <linux/poll.h> #include <linux/poll.h>
struct snd_info_buffer;
/* container for sequencer event (internal use) */ /* container for sequencer event (internal use) */
struct snd_seq_event_cell { struct snd_seq_event_cell {
struct snd_seq_event event; struct snd_seq_event event;
...@@ -99,5 +101,7 @@ void snd_sequencer_memory_done(void); ...@@ -99,5 +101,7 @@ void snd_sequencer_memory_done(void);
/* polling */ /* polling */
int snd_seq_pool_poll_wait(struct snd_seq_pool *pool, struct file *file, poll_table *wait); int snd_seq_pool_poll_wait(struct snd_seq_pool *pool, struct file *file, poll_table *wait);
void snd_seq_info_pool(struct snd_info_buffer *buffer,
struct snd_seq_pool *pool, char *space);
#endif #endif
...@@ -412,7 +412,7 @@ int snd_seq_get_port_info(struct snd_seq_client_port * port, ...@@ -412,7 +412,7 @@ int snd_seq_get_port_info(struct snd_seq_client_port * port,
* initialization or termination of devices (see seq_midi.c). * initialization or termination of devices (see seq_midi.c).
* *
* If callback_all option is set, the callback function is invoked * If callback_all option is set, the callback function is invoked
* at each connnection/disconnection. * at each connection/disconnection.
*/ */
static int subscribe_port(struct snd_seq_client *client, static int subscribe_port(struct snd_seq_client *client,
......
...@@ -186,9 +186,8 @@ static void snd_timer_check_slave(struct snd_timer_instance *slave) ...@@ -186,9 +186,8 @@ static void snd_timer_check_slave(struct snd_timer_instance *slave)
list_for_each_entry(master, &timer->open_list_head, open_list) { list_for_each_entry(master, &timer->open_list_head, open_list) {
if (slave->slave_class == master->slave_class && if (slave->slave_class == master->slave_class &&
slave->slave_id == master->slave_id) { slave->slave_id == master->slave_id) {
list_del(&slave->open_list); list_move_tail(&slave->open_list,
list_add_tail(&slave->open_list, &master->slave_list_head);
&master->slave_list_head);
spin_lock_irq(&slave_active_lock); spin_lock_irq(&slave_active_lock);
slave->master = master; slave->master = master;
slave->timer = master->timer; slave->timer = master->timer;
...@@ -414,8 +413,7 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event) ...@@ -414,8 +413,7 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event)
static int snd_timer_start1(struct snd_timer *timer, struct snd_timer_instance *timeri, static int snd_timer_start1(struct snd_timer *timer, struct snd_timer_instance *timeri,
unsigned long sticks) unsigned long sticks)
{ {
list_del(&timeri->active_list); list_move_tail(&timeri->active_list, &timer->active_list_head);
list_add_tail(&timeri->active_list, &timer->active_list_head);
if (timer->running) { if (timer->running) {
if (timer->hw.flags & SNDRV_TIMER_HW_SLAVE) if (timer->hw.flags & SNDRV_TIMER_HW_SLAVE)
goto __start_now; goto __start_now;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* a subset of information returned via ctl info callback * a subset of information returned via ctl info callback
*/ */
struct link_ctl_info { struct link_ctl_info {
int type; /* value type */ snd_ctl_elem_type_t type; /* value type */
int count; /* item count */ int count; /* item count */
int min_val, max_val; /* min, max values */ int min_val, max_val; /* min, max values */
}; };
......
...@@ -482,8 +482,9 @@ static unsigned int loopback_pos_update(struct loopback_cable *cable) ...@@ -482,8 +482,9 @@ static unsigned int loopback_pos_update(struct loopback_cable *cable)
cable->streams[SNDRV_PCM_STREAM_CAPTURE]; cable->streams[SNDRV_PCM_STREAM_CAPTURE];
unsigned long delta_play = 0, delta_capt = 0; unsigned long delta_play = 0, delta_capt = 0;
unsigned int running; unsigned int running;
unsigned long flags;
spin_lock(&cable->lock); spin_lock_irqsave(&cable->lock, flags);
running = cable->running ^ cable->pause; running = cable->running ^ cable->pause;
if (running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) { if (running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) {
delta_play = jiffies - dpcm_play->last_jiffies; delta_play = jiffies - dpcm_play->last_jiffies;
...@@ -495,10 +496,8 @@ static unsigned int loopback_pos_update(struct loopback_cable *cable) ...@@ -495,10 +496,8 @@ static unsigned int loopback_pos_update(struct loopback_cable *cable)
dpcm_capt->last_jiffies += delta_capt; dpcm_capt->last_jiffies += delta_capt;
} }
if (delta_play == 0 && delta_capt == 0) { if (delta_play == 0 && delta_capt == 0)
spin_unlock(&cable->lock); goto unlock;
return running;
}
if (delta_play > delta_capt) { if (delta_play > delta_capt) {
loopback_bytepos_update(dpcm_play, delta_play - delta_capt, loopback_bytepos_update(dpcm_play, delta_play - delta_capt,
...@@ -510,14 +509,14 @@ static unsigned int loopback_pos_update(struct loopback_cable *cable) ...@@ -510,14 +509,14 @@ static unsigned int loopback_pos_update(struct loopback_cable *cable)
delta_capt = delta_play; delta_capt = delta_play;
} }
if (delta_play == 0 && delta_capt == 0) { if (delta_play == 0 && delta_capt == 0)
spin_unlock(&cable->lock); goto unlock;
return running;
}
/* note delta_capt == delta_play at this moment */ /* note delta_capt == delta_play at this moment */
loopback_bytepos_update(dpcm_capt, delta_capt, BYTEPOS_UPDATE_COPY); loopback_bytepos_update(dpcm_capt, delta_capt, BYTEPOS_UPDATE_COPY);
loopback_bytepos_update(dpcm_play, delta_play, BYTEPOS_UPDATE_POSONLY); loopback_bytepos_update(dpcm_play, delta_play, BYTEPOS_UPDATE_POSONLY);
spin_unlock(&cable->lock); unlock:
spin_unlock_irqrestore(&cable->lock, flags);
return running; return running;
} }
......
...@@ -526,31 +526,21 @@ static int create_special_devices(void) ...@@ -526,31 +526,21 @@ static int create_special_devices(void)
} }
/* These device names follow the official Linux device list,
* Documentation/devices.txt. Let us know if there are other
* common names we should support for compatibility.
* Only those devices not created by the generic code in sound_core.c are
* registered here.
*/
static const struct {
unsigned short minor;
char *name;
umode_t mode;
int *num;
} dev_list[] = { /* list of minor devices */
/* seems to be some confusion here -- this device is not in the device list */
{SND_DEV_DSP16, "dspW", S_IWUGO | S_IRUSR | S_IRGRP,
&num_audiodevs},
{SND_DEV_AUDIO, "audio", S_IWUGO | S_IRUSR | S_IRGRP,
&num_audiodevs},
};
static int dmabuf; static int dmabuf;
static int dmabug; static int dmabug;
module_param(dmabuf, int, 0444); module_param(dmabuf, int, 0444);
module_param(dmabug, int, 0444); module_param(dmabug, int, 0444);
/* additional minors for compatibility */
struct oss_minor_dev {
unsigned short minor;
unsigned int enabled;
} dev_list[] = {
{ SND_DEV_DSP16 },
{ SND_DEV_AUDIO },
};
static int __init oss_init(void) static int __init oss_init(void)
{ {
int err; int err;
...@@ -571,18 +561,12 @@ static int __init oss_init(void) ...@@ -571,18 +561,12 @@ static int __init oss_init(void)
sound_dmap_flag = (dmabuf > 0 ? 1 : 0); sound_dmap_flag = (dmabuf > 0 ? 1 : 0);
for (i = 0; i < ARRAY_SIZE(dev_list); i++) { for (i = 0; i < ARRAY_SIZE(dev_list); i++) {
device_create(sound_class, NULL, j = 0;
MKDEV(SOUND_MAJOR, dev_list[i].minor), NULL, do {
"%s", dev_list[i].name); unsigned short minor = dev_list[i].minor + j * 0x10;
if (!register_sound_special(&oss_sound_fops, minor))
if (!dev_list[i].num) dev_list[i].enabled = (1 << j);
continue; } while (++j < num_audiodevs);
for (j = 1; j < *dev_list[i].num; j++)
device_create(sound_class, NULL,
MKDEV(SOUND_MAJOR,
dev_list[i].minor + (j*0x10)),
NULL, "%s%d", dev_list[i].name, j);
} }
if (sound_nblocks >= MAX_MEM_BLOCKS - 1) if (sound_nblocks >= MAX_MEM_BLOCKS - 1)
...@@ -596,11 +580,11 @@ static void __exit oss_cleanup(void) ...@@ -596,11 +580,11 @@ static void __exit oss_cleanup(void)
int i, j; int i, j;
for (i = 0; i < ARRAY_SIZE(dev_list); i++) { for (i = 0; i < ARRAY_SIZE(dev_list); i++) {
device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor)); j = 0;
if (!dev_list[i].num) do {
continue; if (dev_list[i].enabled & (1 << j))
for (j = 1; j < *dev_list[i].num; j++) unregister_sound_special(dev_list[i].minor);
device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10))); } while (++j < num_audiodevs);
} }
unregister_sound_special(1); unregister_sound_special(1);
......
...@@ -152,10 +152,16 @@ config SND_AZT3328 ...@@ -152,10 +152,16 @@ config SND_AZT3328
select SND_MPU401_UART select SND_MPU401_UART
select SND_PCM select SND_PCM
select SND_RAWMIDI select SND_RAWMIDI
select SND_AC97_CODEC
help help
Say Y here to include support for Aztech AZF3328 (PCI168) Say Y here to include support for Aztech AZF3328 (PCI168)
soundcards. soundcards.
Supported features: AC97-"conformant" mixer, MPU401/OPL3, analog I/O
(16bit/8bit, many sample rates [<= 66.2kHz], NO hardware mixing),
Digital Enhanced Game Port, 1.024MHz multimedia sequencer timer,
ext. codec (I2S port), onboard amp (4W/4Ohms/ch), suspend/resume.
To compile this driver as a module, choose M here: the module To compile this driver as a module, choose M here: the module
will be called snd-azt3328. will be called snd-azt3328.
...@@ -572,13 +578,13 @@ comment "Don't forget to add built-in firmwares for HDSP driver" ...@@ -572,13 +578,13 @@ comment "Don't forget to add built-in firmwares for HDSP driver"
depends on SND_HDSP=y depends on SND_HDSP=y
config SND_HDSPM config SND_HDSPM
tristate "RME Hammerfall DSP MADI" tristate "RME Hammerfall DSP MADI/RayDAT/AIO"
select SND_HWDEP select SND_HWDEP
select SND_RAWMIDI select SND_RAWMIDI
select SND_PCM select SND_PCM
help help
Say Y here to include support for RME Hammerfall DSP MADI Say Y here to include support for RME Hammerfall DSP MADI,
soundcards. RayDAT and AIO soundcards.
To compile this driver as a module, choose M here: the module To compile this driver as a module, choose M here: the module
will be called snd-hdspm. will be called snd-hdspm.
......
...@@ -71,6 +71,12 @@ static const struct ac97_codec_id snd_ac97_codec_id_vendors[] = { ...@@ -71,6 +71,12 @@ static const struct ac97_codec_id snd_ac97_codec_id_vendors[] = {
{ 0x414b4d00, 0xffffff00, "Asahi Kasei", NULL, NULL }, { 0x414b4d00, 0xffffff00, "Asahi Kasei", NULL, NULL },
{ 0x414c4300, 0xffffff00, "Realtek", NULL, NULL }, { 0x414c4300, 0xffffff00, "Realtek", NULL, NULL },
{ 0x414c4700, 0xffffff00, "Realtek", NULL, NULL }, { 0x414c4700, 0xffffff00, "Realtek", NULL, NULL },
/*
* This is an _inofficial_ Aztech Labs entry
* (value might differ from unknown official Aztech ID),
* currently used by the AC97 emulation of the almost-AC97 PCI168 card.
*/
{ 0x415a5400, 0xffffff00, "Aztech Labs (emulated)", NULL, NULL },
{ 0x434d4900, 0xffffff00, "C-Media Electronics", NULL, NULL }, { 0x434d4900, 0xffffff00, "C-Media Electronics", NULL, NULL },
{ 0x43525900, 0xffffff00, "Cirrus Logic", NULL, NULL }, { 0x43525900, 0xffffff00, "Cirrus Logic", NULL, NULL },
{ 0x43585400, 0xffffff00, "Conexant", NULL, NULL }, { 0x43585400, 0xffffff00, "Conexant", NULL, NULL },
...@@ -127,6 +133,7 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = { ...@@ -127,6 +133,7 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = {
{ 0x414c4781, 0xffffffff, "ALC658D", NULL, NULL }, /* already patched */ { 0x414c4781, 0xffffffff, "ALC658D", NULL, NULL }, /* already patched */
{ 0x414c4780, 0xfffffff0, "ALC658", patch_alc655, NULL }, { 0x414c4780, 0xfffffff0, "ALC658", patch_alc655, NULL },
{ 0x414c4790, 0xfffffff0, "ALC850", patch_alc850, NULL }, { 0x414c4790, 0xfffffff0, "ALC850", patch_alc850, NULL },
{ 0x415a5401, 0xffffffff, "AZF3328", patch_aztech_azf3328, NULL },
{ 0x434d4941, 0xffffffff, "CMI9738", patch_cm9738, NULL }, { 0x434d4941, 0xffffffff, "CMI9738", patch_cm9738, NULL },
{ 0x434d4961, 0xffffffff, "CMI9739", patch_cm9739, NULL }, { 0x434d4961, 0xffffffff, "CMI9739", patch_cm9739, NULL },
{ 0x434d4969, 0xffffffff, "CMI9780", patch_cm9780, NULL }, { 0x434d4969, 0xffffffff, "CMI9780", patch_cm9780, NULL },
...@@ -590,9 +597,9 @@ static int snd_ac97_put_volsw(struct snd_kcontrol *kcontrol, ...@@ -590,9 +597,9 @@ static int snd_ac97_put_volsw(struct snd_kcontrol *kcontrol,
snd_ac97_page_restore(ac97, page_save); snd_ac97_page_restore(ac97, page_save);
#ifdef CONFIG_SND_AC97_POWER_SAVE #ifdef CONFIG_SND_AC97_POWER_SAVE
/* check analog mixer power-down */ /* check analog mixer power-down */
if ((val_mask & 0x8000) && if ((val_mask & AC97_PD_EAPD) &&
(kcontrol->private_value & (1<<30))) { (kcontrol->private_value & (1<<30))) {
if (val & 0x8000) if (val & AC97_PD_EAPD)
ac97->power_up &= ~(1 << (reg>>1)); ac97->power_up &= ~(1 << (reg>>1));
else else
ac97->power_up |= 1 << (reg>>1); ac97->power_up |= 1 << (reg>>1);
...@@ -1035,20 +1042,20 @@ static int snd_ac97_dev_free(struct snd_device *device) ...@@ -1035,20 +1042,20 @@ static int snd_ac97_dev_free(struct snd_device *device)
static int snd_ac97_try_volume_mix(struct snd_ac97 * ac97, int reg) static int snd_ac97_try_volume_mix(struct snd_ac97 * ac97, int reg)
{ {
unsigned short val, mask = 0x8000; unsigned short val, mask = AC97_MUTE_MASK_MONO;
if (! snd_ac97_valid_reg(ac97, reg)) if (! snd_ac97_valid_reg(ac97, reg))
return 0; return 0;
switch (reg) { switch (reg) {
case AC97_MASTER_TONE: case AC97_MASTER_TONE:
return ac97->caps & 0x04 ? 1 : 0; return ac97->caps & AC97_BC_BASS_TREBLE ? 1 : 0;
case AC97_HEADPHONE: case AC97_HEADPHONE:
return ac97->caps & 0x10 ? 1 : 0; return ac97->caps & AC97_BC_HEADPHONE ? 1 : 0;
case AC97_REC_GAIN_MIC: case AC97_REC_GAIN_MIC:
return ac97->caps & 0x01 ? 1 : 0; return ac97->caps & AC97_BC_DEDICATED_MIC ? 1 : 0;
case AC97_3D_CONTROL: case AC97_3D_CONTROL:
if (ac97->caps & 0x7c00) { if (ac97->caps & AC97_BC_3D_TECH_ID_MASK) {
val = snd_ac97_read(ac97, reg); val = snd_ac97_read(ac97, reg);
/* if nonzero - fixed and we can't set it */ /* if nonzero - fixed and we can't set it */
return val == 0; return val == 0;
...@@ -1104,7 +1111,10 @@ static void check_volume_resolution(struct snd_ac97 *ac97, int reg, unsigned cha ...@@ -1104,7 +1111,10 @@ static void check_volume_resolution(struct snd_ac97 *ac97, int reg, unsigned cha
*lo_max = *hi_max = 0; *lo_max = *hi_max = 0;
for (i = 0 ; i < ARRAY_SIZE(cbit); i++) { for (i = 0 ; i < ARRAY_SIZE(cbit); i++) {
unsigned short val; unsigned short val;
snd_ac97_write(ac97, reg, 0x8080 | cbit[i] | (cbit[i] << 8)); snd_ac97_write(
ac97, reg,
AC97_MUTE_MASK_STEREO | cbit[i] | (cbit[i] << 8)
);
/* Do the read twice due to buffers on some ac97 codecs. /* Do the read twice due to buffers on some ac97 codecs.
* e.g. The STAC9704 returns exactly what you wrote to the register * e.g. The STAC9704 returns exactly what you wrote to the register
* if you read it immediately. This causes the detect routine to fail. * if you read it immediately. This causes the detect routine to fail.
...@@ -1139,14 +1149,14 @@ static void snd_ac97_change_volume_params2(struct snd_ac97 * ac97, int reg, int ...@@ -1139,14 +1149,14 @@ static void snd_ac97_change_volume_params2(struct snd_ac97 * ac97, int reg, int
unsigned short val, val1; unsigned short val, val1;
*max = 63; *max = 63;
val = 0x8080 | (0x20 << shift); val = AC97_MUTE_MASK_STEREO | (0x20 << shift);
snd_ac97_write(ac97, reg, val); snd_ac97_write(ac97, reg, val);
val1 = snd_ac97_read(ac97, reg); val1 = snd_ac97_read(ac97, reg);
if (val != val1) { if (val != val1) {
*max = 31; *max = 31;
} }
/* reset volume to zero */ /* reset volume to zero */
snd_ac97_write_cache(ac97, reg, 0x8080); snd_ac97_write_cache(ac97, reg, AC97_MUTE_MASK_STEREO);
} }
static inline int printable(unsigned int x) static inline int printable(unsigned int x)
...@@ -1183,16 +1193,16 @@ static int snd_ac97_cmute_new_stereo(struct snd_card *card, char *name, int reg, ...@@ -1183,16 +1193,16 @@ static int snd_ac97_cmute_new_stereo(struct snd_card *card, char *name, int reg,
if (! snd_ac97_valid_reg(ac97, reg)) if (! snd_ac97_valid_reg(ac97, reg))
return 0; return 0;
mute_mask = 0x8000; mute_mask = AC97_MUTE_MASK_MONO;
val = snd_ac97_read(ac97, reg); val = snd_ac97_read(ac97, reg);
if (check_stereo || (ac97->flags & AC97_STEREO_MUTES)) { if (check_stereo || (ac97->flags & AC97_STEREO_MUTES)) {
/* check whether both mute bits work */ /* check whether both mute bits work */
val1 = val | 0x8080; val1 = val | AC97_MUTE_MASK_STEREO;
snd_ac97_write(ac97, reg, val1); snd_ac97_write(ac97, reg, val1);
if (val1 == snd_ac97_read(ac97, reg)) if (val1 == snd_ac97_read(ac97, reg))
mute_mask = 0x8080; mute_mask = AC97_MUTE_MASK_STEREO;
} }
if (mute_mask == 0x8080) { if (mute_mask == AC97_MUTE_MASK_STEREO) {
struct snd_kcontrol_new tmp = AC97_DOUBLE(name, reg, 15, 7, 1, 1); struct snd_kcontrol_new tmp = AC97_DOUBLE(name, reg, 15, 7, 1, 1);
if (check_amix) if (check_amix)
tmp.private_value |= (1 << 30); tmp.private_value |= (1 << 30);
...@@ -1268,9 +1278,11 @@ static int snd_ac97_cvol_new(struct snd_card *card, char *name, int reg, unsigne ...@@ -1268,9 +1278,11 @@ static int snd_ac97_cvol_new(struct snd_card *card, char *name, int reg, unsigne
err = snd_ctl_add(card, kctl); err = snd_ctl_add(card, kctl);
if (err < 0) if (err < 0)
return err; return err;
snd_ac97_write_cache(ac97, reg, snd_ac97_write_cache(
(snd_ac97_read(ac97, reg) & 0x8080) | ac97, reg,
lo_max | (hi_max << 8)); (snd_ac97_read(ac97, reg) & AC97_MUTE_MASK_STEREO)
| lo_max | (hi_max << 8)
);
return 0; return 0;
} }
...@@ -1332,7 +1344,7 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97) ...@@ -1332,7 +1344,7 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
return err; return err;
} }
ac97->regs[AC97_CENTER_LFE_MASTER] = 0x8080; ac97->regs[AC97_CENTER_LFE_MASTER] = AC97_MUTE_MASK_STEREO;
/* build center controls */ /* build center controls */
if ((snd_ac97_try_volume_mix(ac97, AC97_CENTER_LFE_MASTER)) if ((snd_ac97_try_volume_mix(ac97, AC97_CENTER_LFE_MASTER))
...@@ -1410,8 +1422,12 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97) ...@@ -1410,8 +1422,12 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_pc_beep[idx], ac97))) < 0) if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_pc_beep[idx], ac97))) < 0)
return err; return err;
set_tlv_db_scale(kctl, db_scale_4bit); set_tlv_db_scale(kctl, db_scale_4bit);
snd_ac97_write_cache(ac97, AC97_PC_BEEP, snd_ac97_write_cache(
snd_ac97_read(ac97, AC97_PC_BEEP) | 0x801e); ac97,
AC97_PC_BEEP,
(snd_ac97_read(ac97, AC97_PC_BEEP)
| AC97_MUTE_MASK_MONO | 0x001e)
);
} }
/* build Phone controls */ /* build Phone controls */
...@@ -1545,7 +1561,7 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97) ...@@ -1545,7 +1561,7 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
} }
/* build Simulated Stereo Enhancement control */ /* build Simulated Stereo Enhancement control */
if (ac97->caps & 0x0008) { if (ac97->caps & AC97_BC_SIM_STEREO) {
if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_STEREO_ENHANCEMENT], ac97))) < 0) if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_STEREO_ENHANCEMENT], ac97))) < 0)
return err; return err;
} }
...@@ -1557,7 +1573,7 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97) ...@@ -1557,7 +1573,7 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
} }
/* build Loudness control */ /* build Loudness control */
if (ac97->caps & 0x0020) { if (ac97->caps & AC97_BC_LOUDNESS) {
if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_LOUDNESS], ac97))) < 0) if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_LOUDNESS], ac97))) < 0)
return err; return err;
} }
...@@ -2542,8 +2558,8 @@ void snd_ac97_resume(struct snd_ac97 *ac97) ...@@ -2542,8 +2558,8 @@ void snd_ac97_resume(struct snd_ac97 *ac97)
schedule_timeout_uninterruptible(1); schedule_timeout_uninterruptible(1);
} while (time_after_eq(end_time, jiffies)); } while (time_after_eq(end_time, jiffies));
/* FIXME: extra delay */ /* FIXME: extra delay */
ac97->bus->ops->write(ac97, AC97_MASTER, 0x8000); ac97->bus->ops->write(ac97, AC97_MASTER, AC97_MUTE_MASK_MONO);
if (snd_ac97_read(ac97, AC97_MASTER) != 0x8000) if (snd_ac97_read(ac97, AC97_MASTER) != AC97_MUTE_MASK_MONO)
msleep(250); msleep(250);
} else { } else {
end_time = jiffies + msecs_to_jiffies(100); end_time = jiffies + msecs_to_jiffies(100);
...@@ -2747,12 +2763,12 @@ static int master_mute_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem ...@@ -2747,12 +2763,12 @@ static int master_mute_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
int rshift = (kcontrol->private_value >> 12) & 0x0f; int rshift = (kcontrol->private_value >> 12) & 0x0f;
unsigned short mask; unsigned short mask;
if (shift != rshift) if (shift != rshift)
mask = 0x8080; mask = AC97_MUTE_MASK_STEREO;
else else
mask = 0x8000; mask = AC97_MUTE_MASK_MONO;
snd_ac97_update_bits(ac97, AC97_POWERDOWN, 0x8000, snd_ac97_update_bits(ac97, AC97_POWERDOWN, AC97_PD_EAPD,
(ac97->regs[AC97_MASTER] & mask) == mask ? (ac97->regs[AC97_MASTER] & mask) == mask ?
0x8000 : 0); AC97_PD_EAPD : 0);
} }
return err; return err;
} }
...@@ -2765,7 +2781,10 @@ static int tune_mute_led(struct snd_ac97 *ac97) ...@@ -2765,7 +2781,10 @@ static int tune_mute_led(struct snd_ac97 *ac97)
return -ENOENT; return -ENOENT;
msw->put = master_mute_sw_put; msw->put = master_mute_sw_put;
snd_ac97_remove_ctl(ac97, "External Amplifier", NULL); snd_ac97_remove_ctl(ac97, "External Amplifier", NULL);
snd_ac97_update_bits(ac97, AC97_POWERDOWN, 0x8000, 0x8000); /* mute LED on */ snd_ac97_update_bits(
ac97, AC97_POWERDOWN,
AC97_PD_EAPD, AC97_PD_EAPD /* mute LED on */
);
ac97->scaps |= AC97_SCAP_EAPD_LED; ac97->scaps |= AC97_SCAP_EAPD_LED;
return 0; return 0;
} }
...@@ -2780,12 +2799,12 @@ static int hp_master_mute_sw_put(struct snd_kcontrol *kcontrol, ...@@ -2780,12 +2799,12 @@ static int hp_master_mute_sw_put(struct snd_kcontrol *kcontrol,
int rshift = (kcontrol->private_value >> 12) & 0x0f; int rshift = (kcontrol->private_value >> 12) & 0x0f;
unsigned short mask; unsigned short mask;
if (shift != rshift) if (shift != rshift)
mask = 0x8080; mask = AC97_MUTE_MASK_STEREO;
else else
mask = 0x8000; mask = AC97_MUTE_MASK_MONO;
snd_ac97_update_bits(ac97, AC97_POWERDOWN, 0x8000, snd_ac97_update_bits(ac97, AC97_POWERDOWN, AC97_PD_EAPD,
(ac97->regs[AC97_MASTER] & mask) == mask ? (ac97->regs[AC97_MASTER] & mask) == mask ?
0x8000 : 0); AC97_PD_EAPD : 0);
} }
return err; return err;
} }
...@@ -2801,7 +2820,10 @@ static int tune_hp_mute_led(struct snd_ac97 *ac97) ...@@ -2801,7 +2820,10 @@ static int tune_hp_mute_led(struct snd_ac97 *ac97)
snd_ac97_remove_ctl(ac97, "External Amplifier", NULL); snd_ac97_remove_ctl(ac97, "External Amplifier", NULL);
snd_ac97_remove_ctl(ac97, "Headphone Playback", "Switch"); snd_ac97_remove_ctl(ac97, "Headphone Playback", "Switch");
snd_ac97_remove_ctl(ac97, "Headphone Playback", "Volume"); snd_ac97_remove_ctl(ac97, "Headphone Playback", "Volume");
snd_ac97_update_bits(ac97, AC97_POWERDOWN, 0x8000, 0x8000); /* mute LED on */ snd_ac97_update_bits(
ac97, AC97_POWERDOWN,
AC97_PD_EAPD, AC97_PD_EAPD /* mute LED on */
);
return 0; return 0;
} }
......
...@@ -26,6 +26,15 @@ ...@@ -26,6 +26,15 @@
#include "ac97_local.h" #include "ac97_local.h"
#include "ac97_patch.h" #include "ac97_patch.h"
/*
* Forward declarations
*/
static struct snd_kcontrol *snd_ac97_find_mixer_ctl(struct snd_ac97 *ac97,
const char *name);
static int snd_ac97_add_vmaster(struct snd_ac97 *ac97, char *name,
const unsigned int *tlv, const char **slaves);
/* /*
* Chip specific initialization * Chip specific initialization
*/ */
...@@ -2940,6 +2949,49 @@ static int patch_alc850(struct snd_ac97 *ac97) ...@@ -2940,6 +2949,49 @@ static int patch_alc850(struct snd_ac97 *ac97)
return 0; return 0;
} }
static int patch_aztech_azf3328_specific(struct snd_ac97 *ac97)
{
struct snd_kcontrol *kctl_3d_center =
snd_ac97_find_mixer_ctl(ac97, "3D Control - Center");
struct snd_kcontrol *kctl_3d_depth =
snd_ac97_find_mixer_ctl(ac97, "3D Control - Depth");
/*
* 3D register is different from AC97 standard layout
* (also do some renaming, to resemble Windows driver naming)
*/
if (kctl_3d_center) {
kctl_3d_center->private_value =
AC97_SINGLE_VALUE(AC97_3D_CONTROL, 1, 0x07, 0);
snd_ac97_rename_vol_ctl(ac97,
"3D Control - Center", "3D Control - Width"
);
}
if (kctl_3d_depth)
kctl_3d_depth->private_value =
AC97_SINGLE_VALUE(AC97_3D_CONTROL, 8, 0x03, 0);
/* Aztech Windows driver calls the
equivalent control "Modem Playback", thus rename it: */
snd_ac97_rename_vol_ctl(ac97,
"Master Mono Playback", "Modem Playback"
);
snd_ac97_rename_vol_ctl(ac97,
"Headphone Playback", "FM Synth Playback"
);
return 0;
}
static const struct snd_ac97_build_ops patch_aztech_azf3328_ops = {
.build_specific = patch_aztech_azf3328_specific
};
static int patch_aztech_azf3328(struct snd_ac97 *ac97)
{
ac97->build_ops = &patch_aztech_azf3328_ops;
return 0;
}
/* /*
* C-Media CM97xx codecs * C-Media CM97xx codecs
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -25,9 +25,6 @@ Copyright AudioScience, Inc., 2003 ...@@ -25,9 +25,6 @@ Copyright AudioScience, Inc., 2003
#ifndef _HPI6205_H_ #ifndef _HPI6205_H_
#define _HPI6205_H_ #define _HPI6205_H_
/* transitional conditional compile shared between host and DSP */
/* #define HPI6205_NO_HSR_POLL */
#include "hpi_internal.h" #include "hpi_internal.h"
/*********************************************************** /***********************************************************
...@@ -78,8 +75,8 @@ struct bus_master_interface { ...@@ -78,8 +75,8 @@ struct bus_master_interface {
u32 dsp_ack; u32 dsp_ack;
u32 transfer_size_in_bytes; u32 transfer_size_in_bytes;
union { union {
struct hpi_message message_buffer; struct hpi_message_header message_buffer;
struct hpi_response response_buffer; struct hpi_response_header response_buffer;
u8 b_data[HPI6205_SIZEOF_DATA]; u8 b_data[HPI6205_SIZEOF_DATA];
} u; } u;
struct controlcache_6205 control_cache; struct controlcache_6205 control_cache;
......
This diff is collapsed.
This diff is collapsed.
...@@ -33,18 +33,19 @@ struct hpi_adapter_obj { ...@@ -33,18 +33,19 @@ struct hpi_adapter_obj {
}; };
struct hpi_control_cache { struct hpi_control_cache {
u32 init; /**< indicates whether the /** indicates whether the structures are initialized */
structures are initialized */ u16 init;
u16 adap_idx;
u32 control_count; u32 control_count;
u32 cache_size_in_bytes; u32 cache_size_in_bytes;
struct hpi_control_cache_info /** pointer to allocated memory of lookup pointers. */
**p_info; /**< pointer to allocated memory of struct hpi_control_cache_info **p_info;
lookup pointers. */ /** pointer to DSP's control cache. */
struct hpi_control_cache_single u8 *p_cache;
*p_cache; /**< pointer to DSP's control cache. */
}; };
struct hpi_adapter_obj *hpi_find_adapter(u16 adapter_index); struct hpi_adapter_obj *hpi_find_adapter(u16 adapter_index);
u16 hpi_add_adapter(struct hpi_adapter_obj *pao); u16 hpi_add_adapter(struct hpi_adapter_obj *pao);
void hpi_delete_adapter(struct hpi_adapter_obj *pao); void hpi_delete_adapter(struct hpi_adapter_obj *pao);
...@@ -52,13 +53,10 @@ void hpi_delete_adapter(struct hpi_adapter_obj *pao); ...@@ -52,13 +53,10 @@ void hpi_delete_adapter(struct hpi_adapter_obj *pao);
short hpi_check_control_cache(struct hpi_control_cache *pC, short hpi_check_control_cache(struct hpi_control_cache *pC,
struct hpi_message *phm, struct hpi_response *phr); struct hpi_message *phm, struct hpi_response *phr);
struct hpi_control_cache *hpi_alloc_control_cache(const u32 struct hpi_control_cache *hpi_alloc_control_cache(const u32
number_of_controls, const u32 size_in_bytes, number_of_controls, const u32 size_in_bytes, u8 *pDSP_control_buffer);
struct hpi_control_cache_info
*pDSP_control_buffer);
void hpi_free_control_cache(struct hpi_control_cache *p_cache); void hpi_free_control_cache(struct hpi_control_cache *p_cache);
void hpi_sync_control_cache(struct hpi_control_cache *pC, void hpi_cmn_control_cache_sync_to_msg(struct hpi_control_cache *pC,
struct hpi_message *phm, struct hpi_response *phr); struct hpi_message *phm, struct hpi_response *phr);
u16 hpi_validate_response(struct hpi_message *phm, struct hpi_response *phr); u16 hpi_validate_response(struct hpi_message *phm, struct hpi_response *phr);
short hpi_check_buffer_mapping(struct hpi_control_cache *p_cache,
struct hpi_message *phm, void **p, unsigned int *pN);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment