Intensity modulation of laser diode