diff options
Diffstat (limited to 'include/sound')
-rw-r--r-- | include/sound/control.h | 2 | ||||
-rw-r--r-- | include/sound/cs4271.h | 24 | ||||
-rw-r--r-- | include/sound/sh_fsi.h | 76 | ||||
-rw-r--r-- | include/sound/soc-dapm.h | 16 | ||||
-rw-r--r-- | include/sound/soc.h | 147 | ||||
-rw-r--r-- | include/sound/tlv320aic32x4.h | 31 | ||||
-rw-r--r-- | include/sound/wm8903.h | 20 | ||||
-rw-r--r-- | include/sound/wm9081.h | 9 |
8 files changed, 252 insertions, 73 deletions
diff --git a/include/sound/control.h b/include/sound/control.h index 7715e6f00d38..e67db2869360 100644 --- a/include/sound/control.h +++ b/include/sound/control.h @@ -115,6 +115,8 @@ int snd_ctl_add(struct snd_card * card, struct snd_kcontrol * kcontrol); int snd_ctl_remove(struct snd_card * card, struct snd_kcontrol * kcontrol); int snd_ctl_remove_id(struct snd_card * card, struct snd_ctl_elem_id *id); int snd_ctl_rename_id(struct snd_card * card, struct snd_ctl_elem_id *src_id, struct snd_ctl_elem_id *dst_id); +int snd_ctl_activate_id(struct snd_card *card, struct snd_ctl_elem_id *id, + int active); struct snd_kcontrol *snd_ctl_find_numid(struct snd_card * card, unsigned int numid); struct snd_kcontrol *snd_ctl_find_id(struct snd_card * card, struct snd_ctl_elem_id *id); diff --git a/include/sound/cs4271.h b/include/sound/cs4271.h new file mode 100644 index 000000000000..50a059e7d116 --- /dev/null +++ b/include/sound/cs4271.h @@ -0,0 +1,24 @@ +/* + * Definitions for CS4271 ASoC codec driver + * + * Copyright (c) 2010 Alexander Sverdlin <subaparts@yandex.ru> + * + * 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 the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __CS4271_H +#define __CS4271_H + +struct cs4271_platform_data { + int gpio_nreset; /* GPIO driving Reset pin, if any */ +}; + +#endif /* __CS4271_H */ diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h index d79894192ae3..9a155f9d0a12 100644 --- a/include/sound/sh_fsi.h +++ b/include/sound/sh_fsi.h @@ -15,67 +15,29 @@ #define FSI_PORT_A 0 #define FSI_PORT_B 1 -/* flags format - - * 0xABCDEEFF - * - * A: channel size for TDM (input) - * B: channel size for TDM (ooutput) - * C: inversion - * D: mode - * E: input format - * F: output format - */ - #include <linux/clk.h> #include <sound/soc.h> -/* TDM channel */ -#define SH_FSI_SET_CH_I(x) ((x & 0xF) << 28) -#define SH_FSI_SET_CH_O(x) ((x & 0xF) << 24) - -#define SH_FSI_CH_IMASK 0xF0000000 -#define SH_FSI_CH_OMASK 0x0F000000 -#define SH_FSI_GET_CH_I(x) ((x & SH_FSI_CH_IMASK) >> 28) -#define SH_FSI_GET_CH_O(x) ((x & SH_FSI_CH_OMASK) >> 24) - -/* clock inversion */ -#define SH_FSI_INVERSION_MASK 0x00F00000 -#define SH_FSI_LRM_INV (1 << 20) -#define SH_FSI_BRM_INV (1 << 21) -#define SH_FSI_LRS_INV (1 << 22) -#define SH_FSI_BRS_INV (1 << 23) - -/* mode */ -#define SH_FSI_MODE_MASK 0x000F0000 -#define SH_FSI_IN_SLAVE_MODE (1 << 16) /* default master mode */ -#define SH_FSI_OUT_SLAVE_MODE (1 << 17) /* default master mode */ - -/* DI format */ -#define SH_FSI_FMT_MASK 0x000000FF -#define SH_FSI_IFMT(x) (((SH_FSI_FMT_ ## x) & SH_FSI_FMT_MASK) << 8) -#define SH_FSI_OFMT(x) (((SH_FSI_FMT_ ## x) & SH_FSI_FMT_MASK) << 0) -#define SH_FSI_GET_IFMT(x) ((x >> 8) & SH_FSI_FMT_MASK) -#define SH_FSI_GET_OFMT(x) ((x >> 0) & SH_FSI_FMT_MASK) - -#define SH_FSI_FMT_MONO 0 -#define SH_FSI_FMT_MONO_DELAY 1 -#define SH_FSI_FMT_PCM 2 -#define SH_FSI_FMT_I2S 3 -#define SH_FSI_FMT_TDM 4 -#define SH_FSI_FMT_TDM_DELAY 5 -#define SH_FSI_FMT_SPDIF 6 - - -#define SH_FSI_IFMT_TDM_CH(x) \ - (SH_FSI_IFMT(TDM) | SH_FSI_SET_CH_I(x)) -#define SH_FSI_IFMT_TDM_DELAY_CH(x) \ - (SH_FSI_IFMT(TDM_DELAY) | SH_FSI_SET_CH_I(x)) +/* + * flags format + * + * 0x000000BA + * + * A: inversion + * B: format mode + */ -#define SH_FSI_OFMT_TDM_CH(x) \ - (SH_FSI_OFMT(TDM) | SH_FSI_SET_CH_O(x)) -#define SH_FSI_OFMT_TDM_DELAY_CH(x) \ - (SH_FSI_OFMT(TDM_DELAY) | SH_FSI_SET_CH_O(x)) +/* A: clock inversion */ +#define SH_FSI_INVERSION_MASK 0x0000000F +#define SH_FSI_LRM_INV (1 << 0) +#define SH_FSI_BRM_INV (1 << 1) +#define SH_FSI_LRS_INV (1 << 2) +#define SH_FSI_BRS_INV (1 << 3) + +/* B: format mode */ +#define SH_FSI_FMT_MASK 0x000000F0 +#define SH_FSI_FMT_DAI (0 << 4) +#define SH_FSI_FMT_SPDIF (1 << 4) /* diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 8031769ac485..979ed84e07d6 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -157,6 +157,18 @@ .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \ .event = wevent, .event_flags = wflags} +/* additional sequencing control within an event type */ +#define SND_SOC_DAPM_PGA_S(wname, wsubseq, wreg, wshift, winvert, \ + wevent, wflags) \ +{ .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \ + .invert = winvert, .event = wevent, .event_flags = wflags, \ + .subseq = wsubseq} +#define SND_SOC_DAPM_SUPPLY_S(wname, wsubseq, wreg, wshift, winvert, wevent, \ + wflags) \ +{ .id = snd_soc_dapm_supply, .name = wname, .reg = wreg, \ + .shift = wshift, .invert = winvert, .event = wevent, \ + .event_flags = wflags, .subseq = wsubseq} + /* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ #define SOC_PGA_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \ wevent, wflags) \ @@ -450,6 +462,7 @@ struct snd_soc_dapm_widget { unsigned char ext:1; /* has external widgets */ unsigned char force:1; /* force state */ unsigned char ignore_suspend:1; /* kept enabled over suspend */ + int subseq; /* sort within widget type */ int (*power_check)(struct snd_soc_dapm_widget *w); @@ -487,6 +500,9 @@ struct snd_soc_dapm_context { struct snd_soc_dapm_update *update; + void (*seq_notifier)(struct snd_soc_dapm_context *, + enum snd_soc_dapm_type, int); + struct device *dev; /* from parent - for debug */ struct snd_soc_codec *codec; /* parent codec */ struct snd_soc_card *card; /* parent card */ diff --git a/include/sound/soc.h b/include/sound/soc.h index 74921f20a1d8..bfa4836ea107 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -234,6 +234,7 @@ struct snd_soc_codec; struct snd_soc_codec_driver; struct soc_enum; struct snd_soc_jack; +struct snd_soc_jack_zone; struct snd_soc_jack_pin; struct snd_soc_cache_ops; #include <sound/soc-dapm.h> @@ -258,6 +259,16 @@ enum snd_soc_compress_type { SND_SOC_RBTREE_COMPRESSION }; +int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id, + unsigned int freq, int dir); +int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source, + unsigned int freq_in, unsigned int freq_out); + +int snd_soc_register_card(struct snd_soc_card *card); +int snd_soc_unregister_card(struct snd_soc_card *card); +int snd_soc_suspend(struct device *dev); +int snd_soc_resume(struct device *dev); +int snd_soc_poweroff(struct device *dev); int snd_soc_register_platform(struct device *dev, struct snd_soc_platform_driver *platform_drv); void snd_soc_unregister_platform(struct device *dev); @@ -265,7 +276,8 @@ int snd_soc_register_codec(struct device *dev, const struct snd_soc_codec_driver *codec_drv, struct snd_soc_dai_driver *dai_drv, int num_dai); void snd_soc_unregister_codec(struct device *dev); -int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg); +int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, + unsigned int reg); int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, int addr_bits, int data_bits, enum snd_soc_control_type control); @@ -276,6 +288,10 @@ int snd_soc_cache_write(struct snd_soc_codec *codec, unsigned int reg, unsigned int value); int snd_soc_cache_read(struct snd_soc_codec *codec, unsigned int reg, unsigned int *value); +int snd_soc_default_volatile_register(struct snd_soc_codec *codec, + unsigned int reg); +int snd_soc_default_readable_register(struct snd_soc_codec *codec, + unsigned int reg); /* Utility functions to get clock rates from various things */ int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots); @@ -297,6 +313,9 @@ void snd_soc_jack_notifier_register(struct snd_soc_jack *jack, struct notifier_block *nb); void snd_soc_jack_notifier_unregister(struct snd_soc_jack *jack, struct notifier_block *nb); +int snd_soc_jack_add_zones(struct snd_soc_jack *jack, int count, + struct snd_soc_jack_zone *zones); +int snd_soc_jack_get_type(struct snd_soc_jack *jack, int micbias_voltage); #ifdef CONFIG_GPIOLIB int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count, struct snd_soc_jack_gpio *gpios); @@ -321,7 +340,8 @@ void snd_soc_free_ac97_codec(struct snd_soc_codec *codec); *Controls */ struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template, - void *data, char *long_name); + void *data, char *long_name, + const char *prefix); int snd_soc_add_controls(struct snd_soc_codec *codec, const struct snd_kcontrol_new *controls, int num_controls); int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol, @@ -367,6 +387,22 @@ int snd_soc_put_volsw_2r_sx(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); /** + * struct snd_soc_reg_access - Describes whether a given register is + * readable, writable or volatile. + * + * @reg: the register number + * @read: whether this register is readable + * @write: whether this register is writable + * @vol: whether this register is volatile + */ +struct snd_soc_reg_access { + u16 reg; + u16 read; + u16 write; + u16 vol; +}; + +/** * struct snd_soc_jack_pin - Describes a pin to update based on jack detection * * @pin: name of the pin to update @@ -381,6 +417,24 @@ struct snd_soc_jack_pin { }; /** + * struct snd_soc_jack_zone - Describes voltage zones of jack detection + * + * @min_mv: start voltage in mv + * @max_mv: end voltage in mv + * @jack_type: type of jack that is expected for this voltage + * @debounce_time: debounce_time for jack, codec driver should wait for this + * duration before reading the adc for voltages + * @:list: list container + */ +struct snd_soc_jack_zone { + unsigned int min_mv; + unsigned int max_mv; + unsigned int jack_type; + unsigned int debounce_time; + struct list_head list; +}; + +/** * struct snd_soc_jack_gpio - Describes a gpio pin for jack detection * * @gpio: gpio number @@ -388,6 +442,10 @@ struct snd_soc_jack_pin { * @report: value to report when jack detected * @invert: report presence in low state * @debouce_time: debouce time in ms + * @wake: enable as wake source + * @jack_status_check: callback function which overrides the detection + * to provide more complex checks (eg, reading an + * ADC). */ #ifdef CONFIG_GPIOLIB struct snd_soc_jack_gpio { @@ -396,6 +454,8 @@ struct snd_soc_jack_gpio { int report; int invert; int debounce_time; + bool wake; + struct snd_soc_jack *jack; struct delayed_work work; @@ -409,6 +469,7 @@ struct snd_soc_jack { struct list_head pins; int status; struct blocking_notifier_head notifier; + struct list_head jack_zones; }; /* SoC PCM stream information */ @@ -459,18 +520,22 @@ struct snd_soc_codec { struct list_head card_list; int num_dai; enum snd_soc_compress_type compress_type; + size_t reg_size; /* reg_cache_size * reg_word_size */ + int (*volatile_register)(struct snd_soc_codec *, unsigned int); + int (*readable_register)(struct snd_soc_codec *, unsigned int); /* runtime */ struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */ unsigned int active; - unsigned int cache_only:1; /* Suppress writes to hardware */ - unsigned int cache_sync:1; /* Cache needs to be synced to hardware */ + unsigned int cache_bypass:1; /* Suppress access to the cache */ unsigned int suspended:1; /* Codec is in suspend PM state */ unsigned int probed:1; /* Codec has been probed */ unsigned int ac97_registered:1; /* Codec has been AC97 registered */ unsigned int ac97_created:1; /* Codec has been created by SoC */ unsigned int sysfs_registered:1; /* codec has been sysfs registered */ unsigned int cache_init:1; /* codec cache has been initialized */ + u32 cache_only; /* Suppress writes to hardware */ + u32 cache_sync; /* Cache needs to be synced to hardware */ /* codec IO */ void *control_data; /* codec control (i2c/3wire) data */ @@ -503,22 +568,39 @@ struct snd_soc_codec_driver { pm_message_t state); int (*resume)(struct snd_soc_codec *); + /* Default DAPM setup, added after probe() is run */ + const struct snd_soc_dapm_widget *dapm_widgets; + int num_dapm_widgets; + const struct snd_soc_dapm_route *dapm_routes; + int num_dapm_routes; + + /* codec wide operations */ + int (*set_sysclk)(struct snd_soc_codec *codec, + int clk_id, unsigned int freq, int dir); + int (*set_pll)(struct snd_soc_codec *codec, int pll_id, int source, + unsigned int freq_in, unsigned int freq_out); + /* codec IO */ unsigned int (*read)(struct snd_soc_codec *, unsigned int); int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); int (*display_register)(struct snd_soc_codec *, char *, size_t, unsigned int); - int (*volatile_register)(unsigned int); - int (*readable_register)(unsigned int); + int (*volatile_register)(struct snd_soc_codec *, unsigned int); + int (*readable_register)(struct snd_soc_codec *, unsigned int); short reg_cache_size; short reg_cache_step; short reg_word_size; const void *reg_cache_default; + short reg_access_size; + const struct snd_soc_reg_access *reg_access_default; enum snd_soc_compress_type compress_type; /* codec bias level */ int (*set_bias_level)(struct snd_soc_codec *, enum snd_soc_bias_level level); + + void (*seq_notifier)(struct snd_soc_dapm_context *, + enum snd_soc_dapm_type, int); }; /* SoC platform interface */ @@ -617,15 +699,16 @@ struct snd_soc_card { bool instantiated; - int (*probe)(struct platform_device *pdev); - int (*remove)(struct platform_device *pdev); + int (*probe)(struct snd_soc_card *card); + int (*late_probe)(struct snd_soc_card *card); + int (*remove)(struct snd_soc_card *card); /* the pre and post PM functions are used to do any PM work before and * after the codec and DAI's do any PM work. */ - int (*suspend_pre)(struct platform_device *pdev, pm_message_t state); - int (*suspend_post)(struct platform_device *pdev, pm_message_t state); - int (*resume_pre)(struct platform_device *pdev); - int (*resume_post)(struct platform_device *pdev); + int (*suspend_pre)(struct snd_soc_card *card); + int (*suspend_post)(struct snd_soc_card *card); + int (*resume_pre)(struct snd_soc_card *card); + int (*resume_post)(struct snd_soc_card *card); /* callbacks */ int (*set_bias_level)(struct snd_soc_card *, @@ -654,6 +737,14 @@ struct snd_soc_card { struct snd_soc_pcm_runtime *rtd_aux; int num_aux_rtd; + /* + * Card-specific routes and widgets. + */ + struct snd_soc_dapm_widget *dapm_widgets; + int num_dapm_widgets; + struct snd_soc_dapm_route *dapm_routes; + int num_dapm_routes; + struct work_struct deferred_resume_work; /* lists of probed devices belonging to this card */ @@ -665,11 +756,16 @@ struct snd_soc_card { struct list_head paths; struct list_head dapm_list; + /* Generic DAPM context for the card */ + struct snd_soc_dapm_context dapm; + #ifdef CONFIG_DEBUG_FS struct dentry *debugfs_card_root; struct dentry *debugfs_pop_time; #endif u32 pop_time; + + void *drvdata; }; /* SoC machine DAI configuration, glues a codec and cpu DAI together */ @@ -721,6 +817,17 @@ unsigned int snd_soc_write(struct snd_soc_codec *codec, /* device driver data */ +static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card, + void *data) +{ + card->drvdata = data; +} + +static inline void *snd_soc_card_get_drvdata(struct snd_soc_card *card) +{ + return card->drvdata; +} + static inline void snd_soc_codec_set_drvdata(struct snd_soc_codec *codec, void *data) { @@ -754,6 +861,22 @@ static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd) return dev_get_drvdata(&rtd->dev); } +static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) +{ + INIT_LIST_HEAD(&card->dai_dev_list); + INIT_LIST_HEAD(&card->codec_dev_list); + INIT_LIST_HEAD(&card->platform_dev_list); + INIT_LIST_HEAD(&card->widgets); + INIT_LIST_HEAD(&card->paths); + INIT_LIST_HEAD(&card->dapm_list); +} + #include <sound/soc-dai.h> +#ifdef CONFIG_DEBUG_FS +extern struct dentry *snd_soc_debugfs_root; +#endif + +extern const struct dev_pm_ops snd_soc_pm_ops; + #endif diff --git a/include/sound/tlv320aic32x4.h b/include/sound/tlv320aic32x4.h new file mode 100644 index 000000000000..c009f70b4029 --- /dev/null +++ b/include/sound/tlv320aic32x4.h @@ -0,0 +1,31 @@ +/* + * tlv320aic32x4.h -- TLV320AIC32X4 Soc Audio driver platform data + * + * Copyright 2011 Vista Silicon S.L. + * + * Author: Javier Martin <javier.martin@vista-silicon.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef _AIC32X4_PDATA_H +#define _AIC32X4_PDATA_H + +#define AIC32X4_PWR_MICBIAS_2075_LDOIN 0x00000001 +#define AIC32X4_PWR_AVDD_DVDD_WEAK_DISABLE 0x00000002 +#define AIC32X4_PWR_AIC32X4_LDO_ENABLE 0x00000004 +#define AIC32X4_PWR_CMMODE_LDOIN_RANGE_18_36 0x00000008 +#define AIC32X4_PWR_CMMODE_HP_LDOIN_POWERED 0x00000010 + +#define AIC32X4_MICPGA_ROUTE_LMIC_IN2R_10K 0x00000001 +#define AIC32X4_MICPGA_ROUTE_RMIC_IN1L_10K 0x00000002 + +struct aic32x4_pdata { + u32 power_cfg; + u32 micpga_routing; + bool swapdacs; +}; + +#endif diff --git a/include/sound/wm8903.h b/include/sound/wm8903.h index 1eeebd534f7e..cf7ccb76a8de 100644 --- a/include/sound/wm8903.h +++ b/include/sound/wm8903.h @@ -33,6 +33,21 @@ #define WM8903_MICBIAS_ENA_WIDTH 1 /* MICBIAS_ENA */ /* + * WM8903_GPn_FN values + * + * See datasheets for list of valid values per pin + */ +#define WM8903_GPn_FN_GPIO_OUTPUT 0 +#define WM8903_GPn_FN_BCLK 1 +#define WM8903_GPn_FN_IRQ_OUTPT 2 +#define WM8903_GPn_FN_GPIO_INPUT 3 +#define WM8903_GPn_FN_MICBIAS_CURRENT_DETECT 4 +#define WM8903_GPn_FN_MICBIAS_SHORT_DETECT 5 +#define WM8903_GPn_FN_DMIC_LR_CLK_OUTPUT 6 +#define WM8903_GPn_FN_FLL_LOCK_OUTPUT 8 +#define WM8903_GPn_FN_FLL_CLOCK_OUTPUT 9 + +/* * R116 (0x74) - GPIO Control 1 */ #define WM8903_GP1_FN_MASK 0x1F00 /* GP1_FN - [12:8] */ @@ -227,6 +242,8 @@ #define WM8903_GP5_DB_SHIFT 0 /* GP5_DB */ #define WM8903_GP5_DB_WIDTH 1 /* GP5_DB */ +#define WM8903_NUM_GPIO 5 + struct wm8903_platform_data { bool irq_active_low; /* Set if IRQ active low, default high */ @@ -239,7 +256,8 @@ struct wm8903_platform_data { int micdet_delay; /* Delay after microphone detection (ms) */ - u32 gpio_cfg[5]; /* Default register values for GPIO pin mux */ + int gpio_base; + u32 gpio_cfg[WM8903_NUM_GPIO]; /* Default register values for GPIO pin mux */ }; #endif diff --git a/include/sound/wm9081.h b/include/sound/wm9081.h index e173ddbf6bd4..f34b0b1716d8 100644 --- a/include/sound/wm9081.h +++ b/include/sound/wm9081.h @@ -17,9 +17,12 @@ struct wm9081_retune_mobile_setting { u16 config[20]; }; -struct wm9081_retune_mobile_config { - struct wm9081_retune_mobile_setting *configs; - int num_configs; +struct wm9081_pdata { + bool irq_high; /* IRQ is active high */ + bool irq_cmos; /* IRQ is in CMOS mode */ + + struct wm9081_retune_mobile_setting *retune_configs; + int num_retune_configs; }; #endif |