Re: [PATCH] staging: qlge: qlge_main.c: fixed spaces coding style issues
On Mon, 1 Jun 2020 14:19:47 +0900 Benjamin Poirier wrote: > On 2020-05-29 17:17 +0200, Jil Rouceau wrote: > > Fixed the missing spaces before and after binary operators. > > > > Signed-off-by: Jil Rouceau > > This patch does not apply cleanly. I think your base tree is missing > commit ec269f1250c6 ("staging: qlge: Remove unnecessary spaces in > qlge_main.c"). Indeed, I was using Linus' tree instead of linux-next, thank you. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging: qlge: qlge_main.c: fixed spaces coding style issues
Fixed the missing spaces before and after binary operators. Signed-off-by: Jil Rouceau --- Changes in v2: - Based tree changed from Linus' to linux-next. drivers/staging/qlge/qlge_main.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c index 402edaeffe12..1650de13842f 100644 --- a/drivers/staging/qlge/qlge_main.c +++ b/drivers/staging/qlge/qlge_main.c @@ -687,7 +687,7 @@ static int ql_get_8000_flash_params(struct ql_adapter *qdev) size = sizeof(struct flash_params_8000) / sizeof(u32); for (i = 0; i < size; i++, p++) { - status = ql_read_flash_word(qdev, i+offset, p); + status = ql_read_flash_word(qdev, i + offset, p); if (status) { netif_err(qdev, ifup, qdev->ndev, "Error reading flash.\n"); @@ -750,7 +750,7 @@ static int ql_get_8012_flash_params(struct ql_adapter *qdev) return -ETIMEDOUT; for (i = 0; i < size; i++, p++) { - status = ql_read_flash_word(qdev, i+offset, p); + status = ql_read_flash_word(qdev, i + offset, p); if (status) { netif_err(qdev, ifup, qdev->ndev, "Error reading flash.\n"); @@ -1528,7 +1528,7 @@ static void ql_process_mac_rx_page(struct ql_adapter *qdev, struct iphdr *iph = (struct iphdr *)((u8 *)addr + hlen); if (!(iph->frag_off & - htons(IP_MF|IP_OFFSET))) { + htons(IP_MF | IP_OFFSET))) { skb->ip_summed = CHECKSUM_UNNECESSARY; netif_printk(qdev, rx_status, KERN_DEBUG, qdev->ndev, @@ -1635,7 +1635,7 @@ static void ql_process_mac_rx_skb(struct ql_adapter *qdev, struct iphdr *iph = (struct iphdr *)skb->data; if (!(iph->frag_off & - htons(IP_MF|IP_OFFSET))) { + htons(IP_MF | IP_OFFSET))) { skb->ip_summed = CHECKSUM_UNNECESSARY; netif_printk(qdev, rx_status, KERN_DEBUG, qdev->ndev, @@ -1924,7 +1924,7 @@ static void ql_process_mac_split_rx_intr(struct ql_adapter *qdev, struct iphdr *iph = (struct iphdr *)skb->data; if (!(iph->frag_off & - htons(IP_MF|IP_OFFSET))) { + htons(IP_MF | IP_OFFSET))) { skb->ip_summed = CHECKSUM_UNNECESSARY; netif_printk(qdev, rx_status, KERN_DEBUG, qdev->ndev, "TCP checksum done!\n"); @@ -4547,7 +4547,7 @@ static void ql_timer(struct timer_list *t) return; } - mod_timer(&qdev->timer, jiffies + (5*HZ)); + mod_timer(&qdev->timer, jiffies + (5 * HZ)); } static int qlge_probe(struct pci_dev *pdev, @@ -4619,7 +4619,7 @@ static int qlge_probe(struct pci_dev *pdev, * the bus goes dead */ timer_setup(&qdev->timer, ql_timer, TIMER_DEFERRABLE); - mod_timer(&qdev->timer, jiffies + (5*HZ)); + mod_timer(&qdev->timer, jiffies + (5 * HZ)); ql_link_off(qdev); ql_display_dev_info(ndev); atomic_set(&qdev->lb_count, 0); @@ -4753,7 +4753,7 @@ static void qlge_io_resume(struct pci_dev *pdev) netif_err(qdev, ifup, qdev->ndev, "Device was not running prior to EEH.\n"); } - mod_timer(&qdev->timer, jiffies + (5*HZ)); + mod_timer(&qdev->timer, jiffies + (5 * HZ)); netif_device_attach(ndev); } @@ -4815,7 +4815,7 @@ static int qlge_resume(struct pci_dev *pdev) return err; } - mod_timer(&qdev->timer, jiffies + (5*HZ)); + mod_timer(&qdev->timer, jiffies + (5 * HZ)); netif_device_attach(ndev); return 0; -- 2.25.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RESEND PATCH v1 1/6] staging: greybus: audio: Update snd_jack FW usage as per new APIs
snd_soc_jack APIs are modified in recent kernel versions. This patch updates the codec driver to resolve the compilation errors related to jack framework. Signed-off-by: Vaibhav Agarwal --- drivers/staging/greybus/audio_codec.c | 59 +-- 1 file changed, 47 insertions(+), 12 deletions(-) diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c index 08746c85dea6..ebf8484f0ae7 100644 --- a/drivers/staging/greybus/audio_codec.c +++ b/drivers/staging/greybus/audio_codec.c @@ -709,17 +709,29 @@ static struct snd_soc_dai_driver gbaudio_dai[] = { }; static int gbaudio_init_jack(struct gbaudio_module_info *module, -struct snd_soc_codec *codec) +struct snd_soc_card *card) { int ret; + struct snd_soc_jack *jack; + struct snd_soc_jack_pin *headset, *button; + if (!module->jack_mask) return 0; snprintf(module->jack_name, NAME_SIZE, "GB %d Headset Jack", module->dev_id); - ret = snd_soc_jack_new(codec, module->jack_name, module->jack_mask, - &module->headset_jack); + + headset = devm_kzalloc(module->dev, sizeof(*headset), GFP_KERNEL); + if (!headset) + return -ENOMEM; + + headset->pin = module->jack_name; + headset->mask = module->jack_mask; + jack = &module->headset_jack; + + ret = snd_soc_card_jack_new(card, module->jack_name, module->jack_mask, + jack, headset, 1); if (ret) { dev_err(module->dev, "Failed to create new jack\n"); return ret; @@ -730,11 +742,21 @@ static int gbaudio_init_jack(struct gbaudio_module_info *module, snprintf(module->button_name, NAME_SIZE, "GB %d Button Jack", module->dev_id); - ret = snd_soc_jack_new(codec, module->button_name, module->button_mask, - &module->button_jack); + button = devm_kzalloc(module->dev, sizeof(*headset), GFP_KERNEL); + if (!button) { + ret = -ENOMEM; + goto free_headset; + } + + button->pin = module->button_name; + button->mask = module->button_mask; + jack = &module->button_jack; + + ret = snd_soc_card_jack_new(card, module->button_name, + module->button_mask, jack, button, 1); if (ret) { dev_err(module->dev, "Failed to create button jack\n"); - return ret; + goto free_headset; } /* @@ -750,7 +772,7 @@ static int gbaudio_init_jack(struct gbaudio_module_info *module, KEY_MEDIA); if (ret) { dev_err(module->dev, "Failed to set BTN_0\n"); - return ret; + goto free_button; } } @@ -759,7 +781,7 @@ static int gbaudio_init_jack(struct gbaudio_module_info *module, KEY_VOICECOMMAND); if (ret) { dev_err(module->dev, "Failed to set BTN_1\n"); - return ret; + goto free_button; } } @@ -768,7 +790,7 @@ static int gbaudio_init_jack(struct gbaudio_module_info *module, KEY_VOLUMEUP); if (ret) { dev_err(module->dev, "Failed to set BTN_2\n"); - return ret; + goto free_button; } } @@ -777,7 +799,7 @@ static int gbaudio_init_jack(struct gbaudio_module_info *module, KEY_VOLUMEDOWN); if (ret) { dev_err(module->dev, "Failed to set BTN_0\n"); - return ret; + goto free_button; } } @@ -788,6 +810,18 @@ static int gbaudio_init_jack(struct gbaudio_module_info *module, */ return 0; + +free_button: + jack = &module->button_jack; + snd_device_free(card->snd_card, jack->jack); + list_del(&jack->list); + +free_headset: + jack = &module->headset_jack; + snd_device_free(card->snd_card, jack->jack); + list_del(&jack->list); + + return ret; } int gbaudio_register_module(struct gbaudio_module_info *module) @@ -815,7 +849,7 @@ int gbaudio_register_module(struct gbaudio_module_info *module) return -EINVAL; } - ret = gbaudio_init_jack(module, codec); + ret = gbaudio_init_jack(module, component->card); if (ret) { up_write(&card->controls_rwsem); return ret; @@ -942,7 +976,8 @@ void gbaudio_unregister_module(struct gbaudio_module_info *module) #ifdef CONFIG_SND_JACK /* free jack devices
[RESEND PATCH v1 0/6] Enable Greybus Audio codec driver
[REQUEST] This patch series intends to "Enable Greybus Audio codec driver" existing in the staging tree. I have shared the original patch series with Greybus-Dev mailing list and as per the suggestion from Alexandre, I'm also interested to push Greybus Audio to sound soc tree. Thus, now I'm resending it to ASoc maintainers for review. Following is the top level SW design for GB Codec driver and GB Audio modules. +--+ +-->+GBA Module 1 | | +--+ +---+ || | || Greybus | +--+ | SND SOC| Audio+-->+GBA Module 2 | | Framework | Codec| +--+ || Driver | || | +---+ +--+ +-->+GBA Module N | +--+ Patch 5 contains the changes to provide helper APIs to link DAPM DAI widgets for the module added and remove/free component controls for the module removed dynamically. Eventually, I propose to extend snd_soc_xxx APIs for this purpose. Kindly share your inputs. [COVER LETTER] The existing GB Audio codec driver is dependent on MSM8994 Audio driver. During the development stage, this depdency was configured due to various changes involved in MSM Audio driver to enable addtional codec card and some of the changes proposed in mainline ASoC framework. However, these are not the real dependencies and some of them can be easily removed. The folowing patch series includes the changes to resolve unnecessary depedencies and make the codec driver functional with the latest kernel. Patch 1,2: Incudes jack framework related changes. Patch 3,4,5: Resolves compilation error observed with the latest kernel and also provides helper APIs required to allow dynamic addition/removal of modules. Patch 6: Finally provides config options and related Makefile changes to enable GB Codec driver. Thanks to Alexandre for raising the headsup [1] and motivating me to provide the necessary changes. [1] https://lore.kernel.org/lkml/20200507212912.599433-1-alexandre.bell...@bootlin.com/ Vaibhav Agarwal (6): staging: greybus: audio: Update snd_jack FW usage as per new APIs staging: greybus: audio: Maintain jack list within GB Audio module staging: greybus: audio: Resolve compilation errors for GB codec module staging: greybus: audio: Resolve compilation error in topology parser staging: greybus: audio: Add helper APIs for dynamic audio modules staging: greybus: audio: Enable GB codec, audio module compilation. drivers/staging/greybus/Kconfig | 14 +- drivers/staging/greybus/Makefile | 6 +- drivers/staging/greybus/audio_codec.c| 187 + drivers/staging/greybus/audio_codec.h| 12 +- drivers/staging/greybus/audio_helper.c | 197 +++ drivers/staging/greybus/audio_helper.h | 17 ++ drivers/staging/greybus/audio_module.c | 20 +-- drivers/staging/greybus/audio_topology.c | 130 +++ 8 files changed, 427 insertions(+), 156 deletions(-) create mode 100644 drivers/staging/greybus/audio_helper.c create mode 100644 drivers/staging/greybus/audio_helper.h base-commit: ae73e7784871ebe2c43da619b4a1e2c9ff81508d -- 2.26.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RESEND PATCH v1 2/6] staging: greybus: audio: Maintain jack list within GB Audio module
As per the current implementation for GB codec driver, a jack list is maintained for each module. And it expects the list to be populated by the snd_soc_jack structure which would require modifications in mainstream code. However, this is not a necessary requirement and the list can be easily maintained within gbaudio_module_info as well. This patch provides the relevant changes for the same. Signed-off-by: Vaibhav Agarwal --- drivers/staging/greybus/audio_codec.c | 76 ++ drivers/staging/greybus/audio_codec.h | 10 +++- drivers/staging/greybus/audio_module.c | 20 --- 3 files changed, 60 insertions(+), 46 deletions(-) diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c index ebf8484f0ae7..a2ee587e5a79 100644 --- a/drivers/staging/greybus/audio_codec.c +++ b/drivers/staging/greybus/audio_codec.c @@ -712,7 +712,7 @@ static int gbaudio_init_jack(struct gbaudio_module_info *module, struct snd_soc_card *card) { int ret; - + struct gbaudio_jack *gba_jack, *n; struct snd_soc_jack *jack; struct snd_soc_jack_pin *headset, *button; @@ -728,7 +728,8 @@ static int gbaudio_init_jack(struct gbaudio_module_info *module, headset->pin = module->jack_name; headset->mask = module->jack_mask; - jack = &module->headset_jack; + gba_jack = &module->headset; + jack = &gba_jack->jack; ret = snd_soc_card_jack_new(card, module->jack_name, module->jack_mask, jack, headset, 1); @@ -737,6 +738,9 @@ static int gbaudio_init_jack(struct gbaudio_module_info *module, return ret; } + /* Add to module's jack list */ + list_add(&gba_jack->list, &module->jack_list); + if (!module->button_mask) return 0; @@ -745,20 +749,24 @@ static int gbaudio_init_jack(struct gbaudio_module_info *module, button = devm_kzalloc(module->dev, sizeof(*headset), GFP_KERNEL); if (!button) { ret = -ENOMEM; - goto free_headset; + goto free_jack; } button->pin = module->button_name; button->mask = module->button_mask; - jack = &module->button_jack; + gba_jack = &module->button; + jack = &gba_jack->jack; ret = snd_soc_card_jack_new(card, module->button_name, module->button_mask, jack, button, 1); if (ret) { dev_err(module->dev, "Failed to create button jack\n"); - goto free_headset; + goto free_jack; } + /* Add to module's jack list */ + list_add(&gba_jack->list, &module->jack_list); + /* * Currently, max 4 buttons are supported with following key mapping * BTN_0 = KEY_MEDIA @@ -768,58 +776,55 @@ static int gbaudio_init_jack(struct gbaudio_module_info *module, */ if (module->button_mask & SND_JACK_BTN_0) { - ret = snd_jack_set_key(module->button_jack.jack, SND_JACK_BTN_0, + ret = snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_MEDIA); if (ret) { dev_err(module->dev, "Failed to set BTN_0\n"); - goto free_button; + goto free_jack; } } if (module->button_mask & SND_JACK_BTN_1) { - ret = snd_jack_set_key(module->button_jack.jack, SND_JACK_BTN_1, + ret = snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); if (ret) { dev_err(module->dev, "Failed to set BTN_1\n"); - goto free_button; + goto free_jack; } } if (module->button_mask & SND_JACK_BTN_2) { - ret = snd_jack_set_key(module->button_jack.jack, SND_JACK_BTN_2, + ret = snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP); if (ret) { dev_err(module->dev, "Failed to set BTN_2\n"); - goto free_button; + goto free_jack; } } if (module->button_mask & SND_JACK_BTN_3) { - ret = snd_jack_set_key(module->button_jack.jack, SND_JACK_BTN_3, + ret = snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); if (ret) { dev_err(module->dev, "Failed to set BTN_0\n"); - goto free_button; + goto free_jack; } } /* FIXME * verify if this is really required set_bit(INPUT_PROP_NO_DUMMY_RELEASE, - module->button_jack.jack-
[RESEND PATCH v1 3/6] staging: greybus: audio: Resolve compilation errors for GB codec module
Due to dependencies on ASoC framework changes, GB dummy codec module compilation is currently disabled. This patch updates codec driver as per the latest ASoC APIs. Signed-off-by: Vaibhav Agarwal --- drivers/staging/greybus/audio_codec.c | 87 +-- drivers/staging/greybus/audio_codec.h | 2 +- 2 files changed, 44 insertions(+), 45 deletions(-) diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c index a2ee587e5a79..bbd072acda5c 100644 --- a/drivers/staging/greybus/audio_codec.c +++ b/drivers/staging/greybus/audio_codec.c @@ -832,7 +832,7 @@ static int gbaudio_init_jack(struct gbaudio_module_info *module, int gbaudio_register_module(struct gbaudio_module_info *module) { int ret; - struct snd_soc_codec *codec; + struct snd_soc_component *component; struct snd_card *card; struct gbaudio_jack *gba_jack = NULL; struct snd_soc_jack *jack = NULL; @@ -842,8 +842,8 @@ int gbaudio_register_module(struct gbaudio_module_info *module) return -EAGAIN; } - codec = gbcodec->codec; - card = codec->card->snd_card; + component = gbcodec->component; + card = component->card->snd_card; down_write(&card->controls_rwsem); @@ -862,19 +862,20 @@ int gbaudio_register_module(struct gbaudio_module_info *module) } if (module->dapm_widgets) - snd_soc_dapm_new_controls(&codec->dapm, module->dapm_widgets, + snd_soc_dapm_new_controls(&component->dapm, + module->dapm_widgets, module->num_dapm_widgets); if (module->controls) - snd_soc_add_codec_controls(codec, module->controls, - module->num_controls); + snd_soc_add_component_controls(component, module->controls, + module->num_controls); if (module->dapm_routes) - snd_soc_dapm_add_routes(&codec->dapm, module->dapm_routes, + snd_soc_dapm_add_routes(&component->dapm, module->dapm_routes, module->num_dapm_routes); /* card already instantiated, create widgets here only */ - if (codec->card->instantiated) { - snd_soc_dapm_link_component_dai_widgets(codec->card, - &codec->dapm); + if (component->card->instantiated) { + snd_soc_dapm_link_component_dai_widgets(component->card, + &component->dapm); #ifdef CONFIG_SND_JACK /* * register jack devices for this module @@ -882,7 +883,7 @@ int gbaudio_register_module(struct gbaudio_module_info *module) */ list_for_each_entry(gba_jack, &module->jack_list, list) { jack = &gba_jack->jack; - snd_device_register(codec->card->snd_card, + snd_device_register(component->card->snd_card, jack->jack); } #endif @@ -892,9 +893,9 @@ int gbaudio_register_module(struct gbaudio_module_info *module) list_add(&module->list, &gbcodec->module_list); mutex_unlock(&gbcodec->lock); - if (codec->card->instantiated) - ret = snd_soc_dapm_new_widgets(&codec->dapm); - dev_dbg(codec->dev, "Registered %s module\n", module->name); + if (component->card->instantiated) + ret = snd_soc_dapm_new_widgets(component->card); + dev_dbg(component->dev, "Registered %s module\n", module->name); up_write(&card->controls_rwsem); return ret; @@ -965,19 +966,19 @@ static void gbaudio_codec_cleanup(struct gbaudio_module_info *module) void gbaudio_unregister_module(struct gbaudio_module_info *module) { - struct snd_soc_codec *codec = gbcodec->codec; - struct snd_card *card = codec->card->snd_card; + struct snd_soc_component *component = gbcodec->component; + struct snd_card *card = component->card->snd_card; struct gbaudio_jack *gba_jack, *n; struct snd_soc_jack *jack; int mask; - dev_dbg(codec->dev, "Unregister %s module\n", module->name); + dev_dbg(component->dev, "Unregister %s module\n", module->name); down_write(&card->controls_rwsem); mutex_lock(&gbcodec->lock); gbaudio_codec_cleanup(module); list_del(&module->list); - dev_dbg(codec->dev, "Process Unregister %s module\n", module->name); + dev_dbg(component->dev, "Process Unregister %s module\n", module->name); mutex_unlock(&gbcodec->lock); #ifdef CONFIG_SND_JACK @@ -994,99 +995,97 @@ void gbaudio_unregister_module(struct gbaudio_module_info *module) dev_dbg(module->dev, "Re
[RESEND PATCH v1 6/6] staging: greybus: audio: Enable GB codec, audio module compilation.
Currently, GB codec and audio module is conditionally compiled based on GREYBUS_AUDIO_MSM8994. However, audio module is not dependent on MSM8994 platform and can be used generically with any platform that follows GB Audio class specification. Also, GB codec driver corresponds to dummy codec represented by I2S port available on Toshiba AP Bridge. Added config option for the same in kconfig file and accordingly updated Makefile. Signed-off-by: Vaibhav Agarwal --- drivers/staging/greybus/Kconfig | 14 +- drivers/staging/greybus/Makefile | 4 ++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/staging/greybus/Kconfig b/drivers/staging/greybus/Kconfig index d4777f5a8b90..cbcfcbba239b 100644 --- a/drivers/staging/greybus/Kconfig +++ b/drivers/staging/greybus/Kconfig @@ -3,7 +3,7 @@ if GREYBUS config GREYBUS_AUDIO tristate "Greybus Audio Class driver" - depends on SOUND + depends on SOUND && SND_SOC ---help--- Select this option if you have a device that follows the Greybus Audio Class specification. @@ -11,6 +11,18 @@ config GREYBUS_AUDIO To compile this code as a module, chose M here: the module will be called gb-audio.ko +config GREYBUS_AUDIO_APB_CODEC + tristate "Greybus APBridge Audio codec driver" + depends on SND_SOC && GREYBUS_AUDIO + help + Select this option if you have a Toshiba APB device that has I2S + ports and acts as a Greybus "Dummy codec". This device is a + bridge from an APB-I2S port to a Unipro network. + + To compile this code as a module, chose M here: the module + will be called gb-audio-codec.ko + + config GREYBUS_BOOTROM tristate "Greybus Bootrom Class driver" ---help--- diff --git a/drivers/staging/greybus/Makefile b/drivers/staging/greybus/Makefile index 3b4b6cabff19..7c5e89622334 100644 --- a/drivers/staging/greybus/Makefile +++ b/drivers/staging/greybus/Makefile @@ -40,8 +40,8 @@ gb-audio-manager-y:= audio_manager.o audio_manager_module.o #ccflags-y += -DGB_AUDIO_MANAGER_SYSFS #endif -obj-$(CONFIG_GREYBUS_AUDIO_MSM8994)+= gb-audio-codec.o -obj-$(CONFIG_GREYBUS_AUDIO_MSM8994)+= gb-audio-module.o +obj-$(CONFIG_GREYBUS_AUDIO_APB_CODEC) += gb-audio-codec.o +obj-$(CONFIG_GREYBUS_AUDIO_APB_CODEC) += gb-audio-module.o obj-$(CONFIG_GREYBUS_AUDIO)+= gb-audio-gb.o obj-$(CONFIG_GREYBUS_AUDIO)+= gb-audio-apbridgea.o obj-$(CONFIG_GREYBUS_AUDIO)+= gb-audio-manager.o -- 2.26.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RESEND PATCH v1 4/6] staging: greybus: audio: Resolve compilation error in topology parser
Fix compilation errors for GB Audio topology parser code with recent kernel versions. Signed-off-by: Vaibhav Agarwal --- drivers/staging/greybus/audio_topology.c | 130 +++ 1 file changed, 61 insertions(+), 69 deletions(-) diff --git a/drivers/staging/greybus/audio_topology.c b/drivers/staging/greybus/audio_topology.c index 4ac30accf226..7d5e87341a5c 100644 --- a/drivers/staging/greybus/audio_topology.c +++ b/drivers/staging/greybus/audio_topology.c @@ -5,8 +5,8 @@ * Copyright 2015-2016 Linaro Ltd. */ +#include #include "audio_codec.h" -#include "greybus_protocols.h" #define GBAUDIO_INVALID_ID 0xFF @@ -165,15 +165,15 @@ static int gbcodec_mixer_ctl_info(struct snd_kcontrol *kcontrol, struct gbaudio_ctl_pvt *data; struct gb_audio_ctl_elem_info *info; struct gbaudio_module_info *module; - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct gbaudio_codec_info *gbcodec = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct gbaudio_codec_info *gb = snd_soc_component_get_drvdata(comp); - dev_dbg(codec->dev, "Entered %s:%s\n", __func__, kcontrol->id.name); + dev_dbg(comp->dev, "Entered %s:%s\n", __func__, kcontrol->id.name); data = (struct gbaudio_ctl_pvt *)kcontrol->private_value; info = (struct gb_audio_ctl_elem_info *)data->info; if (!info) { - dev_err(codec->dev, "NULL info for %s\n", uinfo->id.name); + dev_err(comp->dev, "NULL info for %s\n", uinfo->id.name); return -EINVAL; } @@ -193,7 +193,7 @@ static int gbcodec_mixer_ctl_info(struct snd_kcontrol *kcontrol, uinfo->value.enumerated.items = max; if (uinfo->value.enumerated.item > max - 1) uinfo->value.enumerated.item = max - 1; - module = find_gb_module(gbcodec, kcontrol->id.name); + module = find_gb_module(gb, kcontrol->id.name); if (!module) return -EINVAL; name = gbaudio_map_controlid(module, data->ctl_id, @@ -201,7 +201,7 @@ static int gbcodec_mixer_ctl_info(struct snd_kcontrol *kcontrol, strlcpy(uinfo->value.enumerated.name, name, NAME_SIZE); break; default: - dev_err(codec->dev, "Invalid type: %d for %s:kcontrol\n", + dev_err(comp->dev, "Invalid type: %d for %s:kcontrol\n", info->type, kcontrol->id.name); break; } @@ -216,11 +216,11 @@ static int gbcodec_mixer_ctl_get(struct snd_kcontrol *kcontrol, struct gbaudio_ctl_pvt *data; struct gb_audio_ctl_elem_value gbvalue; struct gbaudio_module_info *module; - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct gbaudio_codec_info *gb = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct gbaudio_codec_info *gb = snd_soc_component_get_drvdata(comp); struct gb_bundle *bundle; - dev_dbg(codec->dev, "Entered %s:%s\n", __func__, kcontrol->id.name); + dev_dbg(comp->dev, "Entered %s:%s\n", __func__, kcontrol->id.name); module = find_gb_module(gb, kcontrol->id.name); if (!module) return -EINVAL; @@ -239,7 +239,7 @@ static int gbcodec_mixer_ctl_get(struct snd_kcontrol *kcontrol, gb_pm_runtime_put_autosuspend(bundle); if (ret) { - dev_err_ratelimited(codec->dev, "%d:Error in %s for %s\n", ret, + dev_err_ratelimited(comp->dev, "%d:Error in %s for %s\n", ret, __func__, kcontrol->id.name); return ret; } @@ -262,7 +262,7 @@ static int gbcodec_mixer_ctl_get(struct snd_kcontrol *kcontrol, le32_to_cpu(gbvalue.value.enumerated_item[1]); break; default: - dev_err(codec->dev, "Invalid type: %d for %s:kcontrol\n", + dev_err(comp->dev, "Invalid type: %d for %s:kcontrol\n", info->type, kcontrol->id.name); ret = -EINVAL; break; @@ -278,11 +278,11 @@ static int gbcodec_mixer_ctl_put(struct snd_kcontrol *kcontrol, struct gbaudio_ctl_pvt *data; struct gb_audio_ctl_elem_value gbvalue; struct gbaudio_module_info *module; - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct gbaudio_codec_info *gb = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct gbaudio_codec_info *gb = snd_soc_component_get_drvdata(comp); struct gb_bundle *bundle; - dev_dbg(codec->dev, "Entered %s:%s\n", __func__, kcontrol->id.name); + dev_dbg(comp->dev, "Entered %s:%s\n", __func__,
[RESEND PATCH v1 5/6] staging: greybus: audio: Add helper APIs for dynamic audio modules
Greybus Codec driver allows modules to be dynamically added and removed, which further requires updating the DAPM configurations as well. With current snd_soc architecture, dynamic audio modules is not yet supported. This patch provides helper APIs to update DAPM configurations in response to modules which are dynamically added or removed. The source is primarily based on snd_dapm.c Signed-off-by: Vaibhav Agarwal --- drivers/staging/greybus/Makefile | 2 +- drivers/staging/greybus/audio_codec.c | 13 +- drivers/staging/greybus/audio_helper.c | 197 + drivers/staging/greybus/audio_helper.h | 17 +++ 4 files changed, 224 insertions(+), 5 deletions(-) create mode 100644 drivers/staging/greybus/audio_helper.c create mode 100644 drivers/staging/greybus/audio_helper.h diff --git a/drivers/staging/greybus/Makefile b/drivers/staging/greybus/Makefile index 627e44f2a983..3b4b6cabff19 100644 --- a/drivers/staging/greybus/Makefile +++ b/drivers/staging/greybus/Makefile @@ -28,7 +28,7 @@ obj-$(CONFIG_GREYBUS_VIBRATOR)+= gb-vibrator.o # Greybus Audio is a bunch of modules gb-audio-module-y := audio_module.o audio_topology.o -gb-audio-codec-y := audio_codec.o +gb-audio-codec-y := audio_codec.o audio_helper.o gb-audio-gb-y := audio_gb.o gb-audio-apbridgea-y := audio_apbridgea.o gb-audio-manager-y := audio_manager.o audio_manager_module.o diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c index bbd072acda5c..866b3342515f 100644 --- a/drivers/staging/greybus/audio_codec.c +++ b/drivers/staging/greybus/audio_codec.c @@ -14,6 +14,7 @@ #include "audio_codec.h" #include "audio_apbridgea.h" #include "audio_manager.h" +#include "audio_helper.h" static struct gbaudio_codec_info *gbcodec; @@ -874,7 +875,7 @@ int gbaudio_register_module(struct gbaudio_module_info *module) /* card already instantiated, create widgets here only */ if (component->card->instantiated) { - snd_soc_dapm_link_component_dai_widgets(component->card, + gbaudio_dapm_link_component_dai_widgets(component->card, &component->dapm); #ifdef CONFIG_SND_JACK /* @@ -1004,19 +1005,23 @@ void gbaudio_unregister_module(struct gbaudio_module_info *module) if (module->dapm_routes) { dev_dbg(component->dev, "Removing %d routes\n", module->num_dapm_routes); + /* verify routes with controls are removed */ snd_soc_dapm_del_routes(&component->dapm, module->dapm_routes, module->num_dapm_routes); } if (module->controls) { dev_dbg(component->dev, "Removing %d controls\n", module->num_controls); - snd_soc_remove_codec_controls(component, module->controls, - module->num_controls); + /* release control semaphore */ + up_write(&card->controls_rwsem); + gbaudio_remove_component_controls(component, module->controls, + module->num_controls); + down_write(&card->controls_rwsem); } if (module->dapm_widgets) { dev_dbg(component->dev, "Removing %d widgets\n", module->num_dapm_widgets); - snd_soc_dapm_free_controls(&component->dapm, + gbaudio_dapm_free_controls(&component->dapm, module->dapm_widgets, module->num_dapm_widgets); } diff --git a/drivers/staging/greybus/audio_helper.c b/drivers/staging/greybus/audio_helper.c new file mode 100644 index ..e2f113a811ee --- /dev/null +++ b/drivers/staging/greybus/audio_helper.c @@ -0,0 +1,197 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Greybus Audio Sound SoC helper APIs + */ + +#include +#include +#include +#include + +#define gbaudio_dapm_for_each_direction(dir) \ + for ((dir) = SND_SOC_DAPM_DIR_IN; (dir) <= SND_SOC_DAPM_DIR_OUT; \ + (dir)++) + +static void gbaudio_dapm_link_dai_widget(struct snd_soc_dapm_widget *dai_w, +struct snd_soc_card *card) +{ + struct snd_soc_dapm_widget *w; + struct snd_soc_dapm_widget *src, *sink; + struct snd_soc_dai *dai = dai_w->priv; + + /* ...find all widgets with the same stream and link them */ + list_for_each_entry(w, &card->widgets, list) { + if (w->dapm != dai_w->dapm) + continue; + + switch (w->id) { + case snd_soc_dapm_dai_in: + case snd_soc_dapm_dai_out: + continue; + default: + break; + } + +
[PATCH] media: staging: tegra-vde: add missing pm_runtime_put_autosuspend
Call to pm_runtime_get_sync increments counter even in case of failure leading to incorrect ref count. Call pm_runtime_put_autosuspend if pm_runtime_get_sync fails. Signed-off-by: Navid Emamdoost --- drivers/staging/media/tegra-vde/vde.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/tegra-vde/vde.c b/drivers/staging/media/tegra-vde/vde.c index d3e63512a765..52cdd4a91e93 100644 --- a/drivers/staging/media/tegra-vde/vde.c +++ b/drivers/staging/media/tegra-vde/vde.c @@ -776,8 +776,10 @@ static int tegra_vde_ioctl_decode_h264(struct tegra_vde *vde, goto release_dpb_frames; ret = pm_runtime_get_sync(dev); - if (ret < 0) + if (ret < 0) { + pm_runtime_put_autosuspend(dev); goto unlock; + } /* * We rely on the VDE registers reset value, otherwise VDE -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel