Message ID | 20200217142836.23702-3-faiz_abbas@ti.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add Support for MCAN in AM654x-idk | expand |
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@ti.com> > Acked-by: Sriram Dash <sriram.dash@samsung.com> > --- > 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? Shouldn't the regulator be managed by runtime PM as well? Dan
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@ti.com> >> Acked-by: Sriram Dash <sriram.dash@samsung.com> >> --- >> 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
On 2/21/20 8:54 AM, Faiz Abbas wrote: > 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@ti.com> >>> Acked-by: Sriram Dash <sriram.dash@samsung.com> >>> --- >>> 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. Please don't do this, please handle it properly. >> Shouldn't the regulator be managed by runtime PM as well? If so, then make the runtime pm kconfig option mandatory. Marc
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; + ret = m_can_class_register(mcan_class); failed_ret: