-
Notifications
You must be signed in to change notification settings - Fork 5.2k
GPIO Acquire/Release Semantics for 'AI Camera' #6884
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
base: rpi-6.12.y
Are you sure you want to change the base?
GPIO Acquire/Release Semantics for 'AI Camera' #6884
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.
The rest all looks sane, even if the whole thing is rather icky in the first place.
Add support for the 'gpio-gate-clock-releasing' compatible string. The behaviour is identical to that of 'gpio-gate-clock' but the gpio is acquired on 'enable' and released on 'disable'. Signed-off-by: Richard Oliver <richard.oliver@raspberrypi.com>
Document the gpio-gate-clock-releasing compatible string that enables acquire/release GPIO semantics on gpio-gated clocks. Signed-off-by: Richard Oliver <richard.oliver@raspberrypi.com>
The clock using by IMX500 in 'AI Camera' is gpio-gated. The GPIO used is provided by an I2C-controlled rpi-rp2040-gpio-bridge on 'AI Camera'. Both the IMX500 and gpio-bridge share a common regulator for their power supply. Using 'gpio-gate-clock', the 'AI Camera' will never be powered-down as the GPIO provided by the gpio-bridge is always claimed by the clock driver. Switching to 'gpio-gate-clock-releasing' causes the GPIO to be released by the clock driver when the clock is not needed. This allows 'AI Camera' to be powered-down. Signed-off-by: Richard Oliver <richard.oliver@raspberrypi.com>
This change amends various error-paths in imx500_start_streaming() to ensure that pm_runtime refcounts do not remain erroneously incremented on failure. Signed-off-by: Richard Oliver <richard.oliver@raspberrypi.com>
When the imx500 driver is used as part of the 'AI Camera', the poweroff state is never reached as the camera and gpio driver share a regulator. By releasing the GPIOs when they are not in use, 'AI Camera' is able to achieve a powered-down state. Signed-off-by: Richard Oliver <richard.oliver@raspberrypi.com>
7a6146a
to
52ecb02
Compare
I believe all the review comments have been addressed. Are we happy for this to go in @6by9? |
Looks good to me. |
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.
Given that there is no reference counting and no intention of re-entrancy or simultaneous use (at least by this driver), doesn't it point to a programming error for clk_gpio_gate_is_acquired to find that the GPIO is already acquired? In which case, given that clk_gpio_gate_acquire has an error return, why not drop clk_gpio_gate_is_acquired altogether and call ...acquire unconditionally?
{ | ||
struct clk_gpio *clk = to_clk_gpio(hw); | ||
|
||
return clk->gpiod; |
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.
Here you are declaring non-zero to indicate success (although I'd have preferred !!clk->gpiod
to make the type conversion more obvious), but clk_gpio_get_acquire
leaves it containing an error code on failure.
No description provided.