-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Hifiberry DAC+ driver addition to support Hifiberry AMP100 #4102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've highlighted a few issues in the PR. In addition, it would be helpful if you could split the overlay change into a separate commit. It would also be polite to give Clive a mention in your driver commit message.
leds_off = <&hifiberry_dacplus>,"hifiberry-dacplus,leds_off?"; | ||
mute_ext_ctl = <&hifiberry_dacplus>,"hifiberry-dacplus,mute_ext_ctl:0"; | ||
auto_mute = <&hifiberry_dacplus>,"hifiberry-dacplus,auto_mute?"; | ||
reset_ext_ctl = <&hifiberry_dacplus>,"hifiberry-dacplus,reset_ext_ctl?"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This parameter needs to be mentioned in the README.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reset_ext_ctl is actually not used. I will remove it.
sound/soc/bcm/hifiberry_dacplus.c
Outdated
|
||
/* check for HW MUTE as defined in DT-overlay | ||
active high, therefore default to HIGH to MUTE */ | ||
snd_mute_gpio = devm_gpiod_get(&pdev->dev, "mute", GPIOD_OUT_HIGH); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you actually want this to be devm_gpiod_get_optional? That will return NULL if nothing is found, but an error if there is some other problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, followed your proposal and modified the following if(..) to get the dev_info() correct about the selected GPIO, too. Otherwise, it will run into a NULL pointer exception.
P.S. We will be switching to rpi-5.10.y in a matter of days - you might want to target that instead. |
Adds new DT-overlay to control AMP100. Signed-off-by: Joerg Schambacher <joerg@hifiberry.com>
Hopefully all is fixed as required. Also split into two commits. |
@pelwell we have not yet done any testing with 5.10 therefore we keep it for now on 5.4. But I will probably start soon with some 5.10 testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error detection is still necessary with the optional GPIO, but otherwise I'm happy with this.
There are two typos/Germanic spellings in the driver commit message which I would have ignored ("mixeer" and "switchung"), but since you're redoing that commit...
sound/soc/bcm/hifiberry_dacplus.c
Outdated
active high, therefore default to HIGH to MUTE */ | ||
snd_mute_gpio = devm_gpiod_get_optional(&pdev->dev, "mute", GPIOD_OUT_HIGH); | ||
if (snd_mute_gpio) | ||
dev_info(&pdev->dev, "GPIO%i for HW-MUTE selected", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An error is still a possible outcome that should be reported here - an absent property results in a NULL, but some other problem will still cause an error (which is probably what you want).
@pelwell `....
} |
That change looks sensible to me, but I'll reserve final judgement until I've seen the updated commits. |
Sorry Jörg, but checkpatch is complaining about long lines and multi-line comment formatting:
Don't worry about the msleep()s - I don't think timing is critical in this case. |
Ok, most of the style (long lines etc) have been already in there before - so I didn't care...is the policy now to fix all of these? |
While there are some existing long lines, checkpatch is only complaining about the new ones. I'm not expecting you to fix existing problems, but to not make things worse. |
I hope it's fixed now. I usually run checkpatch on the whole file no to miss stuff I screwed some how. Will run it only on the commits from now on. Sorry. |
Take the comma out of your email address on line 7 then it will also fit. I'm happy for you to check more than the minimum, but I don't expect you to. |
Adds the necessary GPIO handling and ALSA mixer extensions. Also fixes a problem with the PLL/CLK control when switching sample rates. Thanks to Clive Messer for the support! Signed-off-by: Joerg Schambacher <joerg@hifiberry.com>
...even without comma - too long. Now reduced to the minimum. |
@j-schambacher Next time you have cause to edit your driver..... Noticed a few log lines without newline termination of text string.
|
@clivem I've just x-checked on my 5.4 setup and at least the last dev_info() gives the desired output without the '\n'. The subsequent message starts on a new line. Same for the headphone message. It is necessary the end with '\n' ? |
Is it strictly necessary, no. Is it still sensible to do it..... ISTR, a big discussion about this back in 2017 when Linus decided to enforce using KERN_CONT with printk() if you wanted multiple logging calls concat'd together, otherwise the behaviour changed to starting every printk() on a newline. Something like that.... @pelwell for the definitive answer? |
I think you are referring to this: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4bcc595ccd80decb4245096e3d1258989c50ed41 Thanks - I wasn't aware of it. It's a shame there wasn't a followup commit to remove all of the unnecessary newlines. ;-) |
@pelwell Yes, I think that was the commit that caused the grumbling from people who hadn't used KERN_CONT flag in the printk and just depended on their last (of many) calls having a "\n", where the behaviour changed, and each of their printk's ended up on separate lines, regardless of whether the individual printk instance was terminated with a newline or not. |
kernel: configs: Enable CONFIG_MEDIA_CEC_RC See: raspberrypi/linux#4109 kernel: Hifiberry DAC+ driver addition to support Hifiberry AMP100 See: raspberrypi/linux#4102 kernel: ARM: dts: Declare Pi400 and CM4 have no audio pins See: https://www.raspberrypi.org/forums/viewtopic.php?f=98&t=301891
@pelwell What is your final crecommendation? Shall I follow Clive's suggestion? I want to fix another little thing in this driver and can fix this, too.. |
I for one have got used to seeing printk and friends with embedded newlines, so to avoid other people pointing out their absence I think you should add them. If at some point there is a global newline cull (think of all the memory saved) then we get rid of them here as well. |
Adds new DT-overlay to control AMP100 and enhances the DAC+ driver with
GPIO handling for RESET and MUTE HW control of the AMP100.
Contains also a small fix for proper PLL control after changing sample rates.
Signed-off-by: Joerg Schambacher joerg@hifiberry.com