CHARLOTTE, N.C. (AP) — Kasey Kahne is in the final stages of completing a deal to drive for Hendrick Motorsports in 2012, The Associated Press has learned.

A person familiar with Kahne’s plans spoke to the AP on the condition of anonymity Tuesday because portions of Kahne’s deal are still being worked out.

Most notably, it’s not clear where Kahne will drive in 2011. HMS is currently at NASCAR’s four-car limit, and Kahne is working out a deal to succeed Mark Martin in the No. 5 car in 2012.

Richard Petty Motorsports announced Tuesday that Kahne, one of the top free agents this year, will leave the team at the end of the season.

That means Kahne still must figure out where he’ll race in 2011. Among his options are a potential ride with Stewart-Haas Racing, which has an alliance with Hendrick, another Chevrolet team, or, should Martin opt out of the final year of his contract, Kahne could get the No. 5.

Kahne has been with a version of the team that is now known as RPM since 2004, when he jumped from Ford’s development program to a Sprint Cup Series ride for then-owner Ray Evernham.

Although he has 11 career wins and two berths in the Chase for the Cup championship, he has not been satisfied with team performance for some time. He was openly critical most of last season, when he overcame a hectic merger between Gillett-Evernham Racing and RPM and severe financial issues inside the organization to win two races and finish 10th in the Chase.

He’s off to a slow start this year, in large part to bad luck, and has just two top-10 finishes through seven races. He’s 26th in the standings.

“Kasey is a very talented driver, and I have enjoyed watching him race,” said team co-owner Richard Petty. “We all wish him nothing but the best and hope he succeeds in anything he chooses to do.”