How to add mtt_can led support?

Hi,

I want to add can status led(control by gpio) to m_ttcan.There’s a devm_can_led_init function in m_ttcan_linux.c,but I don’t know how to indicate gpio for it.Could you kindlly tell me how to do?

static int register_mttcan_dev(struct net_device *dev)
{
	int err;

	dev->netdev_ops = &mttcan_netdev_ops;
	err = register_candev(dev);
	if (!err)
		devm_can_led_init(dev);

	return err;
}

hello CalmCar,

may I know what’s your purpose to trigger led, would you like to trigger led as torch mode or flash mode?
you can have your implementation to enable led as torch mode.
we do not support flash mode, which trigger led flash just for captured frame.
thanks

I got it

add this into dts

leds {
        	compatible = "gpio-leds";

        	can0-rxtx {
        		lable = "can0-rxtx";
        		linux,default-trigger = "can0-rxtx";
        		default-state = "off";
        		gpios = <&tca9539_calmcar_75_1 11 GPIO_ACTIVE_HIGH>;
        	};
        	can1-rxtx {
        		lable = "can1-rxtx";
        		linux,default-trigger = "can1-rxtx";
        		default-state = "off";
        		gpios = <&tca9539_calmcar_75_1 10 GPIO_ACTIVE_HIGH>;
        	};
        	can2-rxtx {
        		lable = "can2-rxtx";
        		linux,default-trigger = "can2-rxtx";
        		default-state = "off";
        		gpios = <&tca9539_calmcar_75_1 9 GPIO_ACTIVE_HIGH>;
        	};

And enable CONFIG_LEDS_GPIO and CONFIG_CAN_LEDS