Re: [PATCH v2 2/3] can: m_can: m_can_platform: Add support for enabling transceiver

From: Faiz Abbas
Date: Fri Feb 21 2020 - 03:43:28 EST


Hi Dan,

On 17/02/20 8:40 pm, Dan Murphy wrote:
> Faiz
>
> On 2/17/20 8:28 AM, Faiz Abbas wrote:
>> CAN transceivers on some boards have a standby line which can be
>> toggled to enable/disable the transceiver. Model this as an optional
>> fixed xceiver regulator.
>>
>> Signed-off-by: Faiz Abbas <faiz_abbas@xxxxxx>
>> Acked-by: Sriram Dash <sriram.dash@xxxxxxxxxxx>
>> ---
>> Â drivers/net/can/m_can/m_can_platform.c | 6 ++++++
>> Â 1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/net/can/m_can/m_can_platform.c
>> b/drivers/net/can/m_can/m_can_platform.c
>> index 38ea5e600fb8..719468fab507 100644
>> --- a/drivers/net/can/m_can/m_can_platform.c
>> +++ b/drivers/net/can/m_can/m_can_platform.c
>> @@ -6,6 +6,7 @@
>> Â // Copyright (C) 2018-19 Texas Instruments Incorporated -
>> http://www.ti.com/
>> Â Â #include <linux/platform_device.h>
>> +#include <linux/regulator/consumer.h>
>> Â Â #include "m_can.h"
>> Â @@ -57,6 +58,7 @@ static int m_can_plat_probe(struct platform_device
>> *pdev)
>> Â {
>> ÂÂÂÂÂ struct m_can_classdev *mcan_class;
>> ÂÂÂÂÂ struct m_can_plat_priv *priv;
>> +ÂÂÂ struct regulator *reg_xceiver;
>> ÂÂÂÂÂ struct resource *res;
>> ÂÂÂÂÂ void __iomem *addr;
>> ÂÂÂÂÂ void __iomem *mram_addr;
>> @@ -111,6 +113,10 @@ static int m_can_plat_probe(struct
>> platform_device *pdev)
>> Â ÂÂÂÂÂ m_can_init_ram(mcan_class);
>> Â +ÂÂÂ reg_xceiver = devm_regulator_get_optional(&pdev->dev, "xceiver");
>> +ÂÂÂ if (PTR_ERR(reg_xceiver) == -EPROBE_DEFER)
>> +ÂÂÂÂÂÂÂ return -EPROBE_DEFER;
>> +
>
> Where is this regulator enabled?

I have set regulator-boot-on flag in the dt so this didn't require an
enable.

> Shouldn't the regulator be managed by runtime PM as well?
>

Let me try this out.

Thanks,
Faiz