[PATCH 0/2] ASoC: tidyup for jack.h
Hi Mark
These are jack.h related tidyup.
Kuninori Morimoto (2): ASoC: soc-core: tidyup jack.h ASoC: add soc-jack.h
include/sound/soc-jack.h | 132 ++++++++++++++++++++++++++++++++++++ include/sound/soc.h | 122 +-------------------------------- include/trace/events/asoc.h | 1 + sound/soc/soc-core.c | 1 - 4 files changed, 134 insertions(+), 122 deletions(-) create mode 100644 include/sound/soc-jack.h
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
soc-core.c don't need sound/jack.h anymore, but asoc.h needs it. This patch fixup header magic.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- include/trace/events/asoc.h | 1 + sound/soc/soc-core.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/trace/events/asoc.h b/include/trace/events/asoc.h index 40c300fe704d..4d8ef71090af 100644 --- a/include/trace/events/asoc.h +++ b/include/trace/events/asoc.h @@ -7,6 +7,7 @@
#include <linux/ktime.h> #include <linux/tracepoint.h> +#include <sound/jack.h>
#define DAPM_DIRECT "(direct)" #define DAPM_ARROW(dir) (((dir) == SND_SOC_DAPM_DIR_OUT) ? "->" : "<-") diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 50b4ce6374a0..4a86e987dcf0 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -32,7 +32,6 @@ #include <linux/of_graph.h> #include <linux/dmi.h> #include <sound/core.h> -#include <sound/jack.h> #include <sound/pcm.h> #include <sound/pcm_params.h> #include <sound/soc.h>
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
ALSA SoC has soc-jack.c, but doesn't have soc-jack.h. This patch creates new soc-jack.h and moves snd_soc_jack_xxx() from soc.h.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- include/sound/soc-jack.h | 132 +++++++++++++++++++++++++++++++++++++++ include/sound/soc.h | 122 +----------------------------------- 2 files changed, 133 insertions(+), 121 deletions(-) create mode 100644 include/sound/soc-jack.h
diff --git a/include/sound/soc-jack.h b/include/sound/soc-jack.h new file mode 100644 index 000000000000..a0abb1ee5110 --- /dev/null +++ b/include/sound/soc-jack.h @@ -0,0 +1,132 @@ +/* SPDX-License-Identifier: GPL-2.0 + * + * soc-jack.h + * + * Copyright (C) 2019 Renesas Electronics Corp. + * Kuninori Morimoto kuninori.morimoto.gx@renesas.com + */ +#ifndef __SOC_JACK_H +#define __SOC_JACK_H + +/** + * struct snd_soc_jack_pin - Describes a pin to update based on jack detection + * + * @pin: name of the pin to update + * @mask: bits to check for in reported jack status + * @invert: if non-zero then pin is enabled when status is not reported + * @list: internal list entry + */ +struct snd_soc_jack_pin { + struct list_head list; + const char *pin; + int mask; + bool invert; +}; + +/** + * 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: internal list entry + */ +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: legacy gpio number + * @idx: gpio descriptor index within the function of the GPIO + * consumer device + * @gpiod_dev: GPIO consumer device + * @name: gpio name. Also as connection ID for the GPIO consumer + * device function name lookup + * @report: value to report when jack detected + * @invert: report presence in low state + * @debounce_time: debounce 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). + */ +struct snd_soc_jack_gpio { + unsigned int gpio; + unsigned int idx; + struct device *gpiod_dev; + const char *name; + int report; + int invert; + int debounce_time; + bool wake; + + /* private: */ + struct snd_soc_jack *jack; + struct delayed_work work; + struct notifier_block pm_notifier; + struct gpio_desc *desc; + + void *data; + /* public: */ + int (*jack_status_check)(void *data); +}; + +struct snd_soc_jack { + struct mutex mutex; + struct snd_jack *jack; + struct snd_soc_card *card; + struct list_head pins; + int status; + struct blocking_notifier_head notifier; + struct list_head jack_zones; +}; + +/* Jack reporting */ +void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask); +int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count, + struct snd_soc_jack_pin *pins); +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); +int snd_soc_jack_add_gpiods(struct device *gpiod_dev, + struct snd_soc_jack *jack, + int count, struct snd_soc_jack_gpio *gpios); +void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count, + struct snd_soc_jack_gpio *gpios); +#else +static inline int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count, + struct snd_soc_jack_gpio *gpios) +{ + return 0; +} + +static inline int snd_soc_jack_add_gpiods(struct device *gpiod_dev, + struct snd_soc_jack *jack, + int count, + struct snd_soc_jack_gpio *gpios) +{ + return 0; +} + +static inline void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count, + struct snd_soc_jack_gpio *gpios) +{ +} +#endif + +#endif /* __SOC_JACK_H */ diff --git a/include/sound/soc.h b/include/sound/soc.h index 33c289f6097c..b51e96121fa1 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -490,46 +490,6 @@ int snd_soc_params_to_bclk(struct snd_pcm_hw_params *parms); int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, const struct snd_pcm_hardware *hw);
-/* Jack reporting */ -void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask); -int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count, - struct snd_soc_jack_pin *pins); -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); -int snd_soc_jack_add_gpiods(struct device *gpiod_dev, - struct snd_soc_jack *jack, - int count, struct snd_soc_jack_gpio *gpios); -void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count, - struct snd_soc_jack_gpio *gpios); -#else -static inline int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count, - struct snd_soc_jack_gpio *gpios) -{ - return 0; -} - -static inline int snd_soc_jack_add_gpiods(struct device *gpiod_dev, - struct snd_soc_jack *jack, - int count, - struct snd_soc_jack_gpio *gpios) -{ - return 0; -} - -static inline void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count, - struct snd_soc_jack_gpio *gpios) -{ -} -#endif - struct snd_ac97 *snd_soc_alloc_ac97_component(struct snd_soc_component *component); struct snd_ac97 *snd_soc_new_ac97_component(struct snd_soc_component *component, unsigned int id, unsigned int id_mask); @@ -616,87 +576,6 @@ int snd_soc_get_strobe(struct snd_kcontrol *kcontrol, int snd_soc_put_strobe(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
-/** - * struct snd_soc_jack_pin - Describes a pin to update based on jack detection - * - * @pin: name of the pin to update - * @mask: bits to check for in reported jack status - * @invert: if non-zero then pin is enabled when status is not reported - * @list: internal list entry - */ -struct snd_soc_jack_pin { - struct list_head list; - const char *pin; - int mask; - bool invert; -}; - -/** - * 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: internal list entry - */ -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: legacy gpio number - * @idx: gpio descriptor index within the function of the GPIO - * consumer device - * @gpiod_dev: GPIO consumer device - * @name: gpio name. Also as connection ID for the GPIO consumer - * device function name lookup - * @report: value to report when jack detected - * @invert: report presence in low state - * @debounce_time: debounce 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). - */ -struct snd_soc_jack_gpio { - unsigned int gpio; - unsigned int idx; - struct device *gpiod_dev; - const char *name; - int report; - int invert; - int debounce_time; - bool wake; - - /* private: */ - struct snd_soc_jack *jack; - struct delayed_work work; - struct notifier_block pm_notifier; - struct gpio_desc *desc; - - void *data; - /* public: */ - int (*jack_status_check)(void *data); -}; - -struct snd_soc_jack { - struct mutex mutex; - struct snd_jack *jack; - struct snd_soc_card *card; - struct list_head pins; - int status; - struct blocking_notifier_head notifier; - struct list_head jack_zones; -}; - /* SoC PCM stream information */ struct snd_soc_pcm_stream { const char *stream_name; @@ -1415,5 +1294,6 @@ static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm)
#include <sound/soc-component.h> #include <sound/soc-card.h> +#include <sound/soc-jack.h>
#endif
On 30 Nov 2020 08:44:56 +0900, Kuninori Morimoto wrote:
These are jack.h related tidyup.
Kuninori Morimoto (2): ASoC: soc-core: tidyup jack.h ASoC: add soc-jack.h
include/sound/soc-jack.h | 132 ++++++++++++++++++++++++++++++++++++ include/sound/soc.h | 122 +-------------------------------- include/trace/events/asoc.h | 1 + sound/soc/soc-core.c | 1 - 4 files changed, 134 insertions(+), 122 deletions(-) create mode 100644 include/sound/soc-jack.h
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/2] ASoC: soc-core: tidyup jack.h commit: 9e8434a0083b135b7fc34bd8fbd7cb99a47b3c08 [2/2] ASoC: add soc-jack.h commit: ddfbe828f2ed13f9145c5c5fa17cb0a1b58e0bc9
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (2)
-
Kuninori Morimoto
-
Mark Brown