For heaven's sake don't use 2x2s. (Treated 2x2s that are for sale are most likely short ones meant for deck railing, um, 'pickets', whatever you'd call the vertical infill). Too twisty and WAY too weak, also you probably can't get 'em in long enough lengths anyhow.
Use p/t 4x4s for all corners, for sure. (Unless you use something stronger, like larger-diameter cedar posts)
For line posts, if strength is not a big issue i.e. there is no exposure to anybody's loose dogs or coyotes AND you do not expect to ever accidentally whomp into the fence with the lawnmower, you can TRY cheaping out by using p/t 2x4s instead of 4x4s. Use them end-on, so that when you are standing outside the fence looking at it, you are seeing the 2" edge not the wider edge. HOWEVER this will give you a weaker and wibblier fence. If you adequately frame between them, top and bottom, with 2x4s (p/t for the one that is virtually on the ground, plain wood for the top 'rail') then the difference is not huge, so if you were planning on doing that ANYhow, maybe 2x4 line posts is a reasonable option. But if you were planning on NOT having any (that is to say, two runs of) horizontal lumber between posts, then I for sure would stick with p/t 4x4s for line posts too. They are not THAT expensive.
In case you were going to ask about t-posts, I would put them in the same category as 2x4s only harder to attach horizontal framing to. I suppose if you were going to skip any horizontal lumber in the fence and were dead set on not using 4x4s an argument could be made that WELL DRIVEN HEAVY DUTY t-posts are slightly better than p/t 2x4s in most soils... but then they are also more expensive unless you can get some old ones for free or cheap
Good luck, have fun,
Pat
Use p/t 4x4s for all corners, for sure. (Unless you use something stronger, like larger-diameter cedar posts)
For line posts, if strength is not a big issue i.e. there is no exposure to anybody's loose dogs or coyotes AND you do not expect to ever accidentally whomp into the fence with the lawnmower, you can TRY cheaping out by using p/t 2x4s instead of 4x4s. Use them end-on, so that when you are standing outside the fence looking at it, you are seeing the 2" edge not the wider edge. HOWEVER this will give you a weaker and wibblier fence. If you adequately frame between them, top and bottom, with 2x4s (p/t for the one that is virtually on the ground, plain wood for the top 'rail') then the difference is not huge, so if you were planning on doing that ANYhow, maybe 2x4 line posts is a reasonable option. But if you were planning on NOT having any (that is to say, two runs of) horizontal lumber between posts, then I for sure would stick with p/t 4x4s for line posts too. They are not THAT expensive.
In case you were going to ask about t-posts, I would put them in the same category as 2x4s only harder to attach horizontal framing to. I suppose if you were going to skip any horizontal lumber in the fence and were dead set on not using 4x4s an argument could be made that WELL DRIVEN HEAVY DUTY t-posts are slightly better than p/t 2x4s in most soils... but then they are also more expensive unless you can get some old ones for free or cheap

Good luck, have fun,
Pat