On 8/16/19 4:30 PM, Dan Murphy wrote: >>> +static u32 tcan4x5x_read_reg(struct m_can_classdev *cdev, int reg) >>> +{ >>> + struct tcan4x5x_priv *priv = (struct tcan4x5x_priv *)cdev->device_data; >>> + u32 val; >>> + >>> + tcan4x5x_check_wake(priv); >> Do you have to call this every time you access the Chip? Can you move >> this into the open() function? > > Yes we have to call this as the device will time out without bus activity. >From my naive point of view, I'd put the device into normal mode in the ndo_open callback. > The only way to wake it up is through a pulse of the wake up GPIO. SPI > interface is disabled in sleep mode. Looking at figure 23 in the datasheet the only transition from normal mode to any other mode is via writing MO = 01 (standby) or MO = 00 (sleep). I think with MO they mean the MODE_SEL bits of register 0x800. > So the function tests to see if the device went to sleep and if it is it > wakes it up. > > Putting this in the open function only wakes the device up initially. > > Section 8.4.3 of the data sheet [1] regards, Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |