US stocks trade mixed but notch a weekly gain as earnings impress and inflation cools