Retirement tax questions

Pension income is State Tax Free, Thought Roth contributions had to be EARNED income to be eligible for an IRA contribution..? we only have W2 Box1 wages of 11500.. can we do all of that amount or do we need to deduct any SS or medicare ?