ASoC: hifiberry_studio: change driver name and add support for new soundcards#7487
Conversation
The driver is going to add support for other HiFiBerry Studio-family cards (e.g. AES/SPDIF variants) that share the same onboard controller/firmware and I2C register protocol as the DAC8x cards. Rename the file and its DAC8x-specific identifiers to the more generic "hifiberry_studio" name in preparation for that, without changing any behaviour. No functional change. Signed-off-by: j-schambacher <joerg@hifiberry.com>
pelwell
left a comment
There was a problem hiding this comment.
This is a large change to non-mainline code that I don't care about that much. It seems to be well written, but I haven't been through it line by line checking the functionality - there are just a few minor comments.
| * analog card to report here, so only look for it for AES cards. | ||
| */ | ||
| if (priv->card_type == AES) { | ||
| dev_info(&pdev->dev, "GPIO checking ..\n"); |
There was a problem hiding this comment.
This is unnecessary log spam, presumably left over from development.
There was a problem hiding this comment.
Yep, going to remove it.
| static struct i2c_client *hb_uni_i2c_client; | ||
| struct hb_uni_private { | ||
| static struct i2c_client *hb_studio_i2c_client; | ||
| struct hb_studio_private { |
There was a problem hiding this comment.
I think a lot of these name changes would have been better in an up-front commit, so that the logic changes stand out, but don't resubmit it now - it's just feedback for next time.
There was a problem hiding this comment.
Ok, thanks. I know, it's a lot of rewritten and renamed stuff.
| &priv->card_info.master_vol, MUTE_OUTPUTS - MASTER_VOL); | ||
| regcache_cache_only(priv->regmap, false); | ||
| ret = of_property_read_string(pdev->dev.of_node, | ||
| "card-type", &priv->type); |
There was a problem hiding this comment.
This value seems to only be used here - the "using default" message doesn't appear to have any consequences.
There was a problem hiding this comment.
Another leftover from development and now disconnected from any other control. I left it in under the impression that we can potentially use it somehow. I'm going to remove it, also in the overlays.
Generalize the driver to support different cards that share the same onboard controller/firmware and I2C register protocol: the existing DAC8x/ADC8x analog cards and the new Studio Digi/AES card. - Split the onboard controller handling into a separate I2C client driver (compatible "hifiberry,hb-studio-ctrl") that creates a shared regmap and reads firmware/hardware capabilities at probe time. The card type is decoded from the last 4 bytes of the controller's UUID and used by the platform/machine driver. - It now registers different ALSA controls depending on the detected card. - Add AES input-rate detection and locking: capture on an AES card requires DIR/RX mode as the Pi's I2S interface can only run at the same sample rate for either direction. - Add GPIO7 interrupt handling (FS-change / PLL-lost) for Digi/AES cards: the IRQ stops any active playback/capture substreams via snd_pcm_stop() under a spinlock shared with the hw_params/startup/ shutdown paths. The IRQ is only requested for AES-type cards, decided automatically from the detected card type. - Add the "hifiberry,hifiberry-studio" compatible string alongside the existing "hifiberry,hifiberry-studio-dac8x" one, used by card variants that don't need the DAC8x-specific compatible string for backwards compatibility. Signed-off-by: j-schambacher <joerg@hifiberry.com>
Add hifiberry-studio-digi-overlay.dts for the Studio Digi/AES card, wired the same way as the DAC8x PRO overlay (i2s1, clk-provider), plus the GPIO7 FS-change/PLL-lost interrupt line the driver now requests automatically for AES-type cards. Both existing DAC8x overlays use the "hb_studio_ctrl" I2C client node (compatible "hifiberry,hb-studio-ctrl") so the driver's separate controller probe can be attached. A "no_controls" can be used to skip registering the ALSA controls for a card. The PRO overlay also switches to the new "hifiberry,hifiberry-studio" compatible string and adds the informational "card-type" property; the base overlay keeps "hifiberry,hifiberry-studio-dac8x" for backwards compatibility. Signed-off-by: j-schambacher <joerg@hifiberry.com>
The Kconfig symbol backing the HiFiBerry Studio driver was renamed from SND_BCM2708_SOC_HIFIBERRY_STUDIO_DAC8X to SND_BCM2708_SOC_HIFIBERRY_STUDIO as part of generalizing the driver beyond the DAC8x card, but the defconfigs enabling it by default were left referencing the old, now nonexistent symbol name, silently dropping the driver from being built by these defconfigs. Update all three affected defconfigs to the new symbol name. Signed-off-by: j-schambacher <joerg@hifiberry.com>
5e86a58 to
57efdb6
Compare
As discussed the first commit is only the name change w/o functional changes.
ASoC: rename hifiberry_studio_dac8x.c to hifiberry_studio.cPure rename: file, DAC8x-specific identifiers, the Kconfig symbol and the
Makefile object/obj-y references. No behavioural change.
ASoC: hifiberry_studio: add multi-card and Digi/AES supportSplits the onboard controller handling into a separate I2C client driver
(
hifiberry,hb-studio-ctrl) that reads firmware/hardware version, UUID,channel counts and clock capabilities once at probe; the card type
(DAC8x/ADC8x vs. AES) is decoded from the controller UUID and
published for the platform/machine driver, which defers
(
-EPROBE_DEFER) until it's available. Registers adifferent ALSA control set depending on detected card type, adds
AES input-rate detection/locking (capture forces DIR/RX only when a
valid, matching-rate AES input is present; mismatched rates are
rejected), and adds GPIO7 FS-change/PLL-lost interrupt handling for
AES-type cards only, decided automatically from the detected card type.
overlays: hifiberry-studio: add Digi/AES overlay, register controllerAdds
hifiberry-studio-digi-overlay.dts(wired like the DAC8x PROoverlay: i2s1, clk-provider) plus the GPIO7 interrupt line. Adds the
hb_studio_ctrlI2C client node and ano_controlsoverride to the twoexisting DAC8x overlays. The PRO overlay switches to the new
hifiberry,hifiberry-studiocompatible string; the base overlay keepshifiberry,hifiberry-studio-dac8xfor backwards compatibility.arm64: configs: fix stale HIFIBERRY_STUDIO_DAC8X symbol namebcm2711_defconfig,bcm2711_rt_defconfigandbcm2712_defconfig.Updates all three to the new name.