[PATCH v3 6/9] can: m_can: Add use of optional regulator

Markus Schneider-Pargmann posted 9 patches 1 month, 2 weeks ago
There is a newer version of this series
[PATCH v3 6/9] can: m_can: Add use of optional regulator
Posted by Markus Schneider-Pargmann 1 month, 2 weeks ago
Add support to use a regulator for the core. This is optional and used
to register the dependency on the regulator.

Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>
---
 drivers/net/can/m_can/m_can.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index c56d61b0d20b05be36c95ec4a6651b0457883b66..b009575354cf5f19e93950bb17d448f81609aae4 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -23,6 +23,7 @@
 #include <linux/pinctrl/consumer.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
+#include <linux/regulator/consumer.h>
 
 #include "m_can.h"
 
@@ -2383,6 +2384,11 @@ struct m_can_classdev *m_can_class_allocate_dev(struct device *dev,
 	if (dev->of_node && of_property_read_bool(dev->of_node, "wakeup-source"))
 		device_set_wakeup_capable(dev, true);
 
+	ret = devm_regulator_get_enable_optional(dev, "vio");
+	if (ret)
+		return ERR_PTR(
+			dev_err_probe(dev, ret, "Failed to get or enable optional regulator\n"));
+
 	/* Get TX FIFO size
 	 * Defines the total amount of echo buffers for loopback
 	 */

-- 
2.45.2
Re: [PATCH v3 6/9] can: m_can: Add use of optional regulator
Posted by Vincent MAILHOL 1 month, 2 weeks ago
On Fri. 11 Oct. 2024 at 22:20, Markus Schneider-Pargmann
<msp@baylibre.com> wrote:
> Add support to use a regulator for the core. This is optional and used
> to register the dependency on the regulator.
>
> Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>

Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>