Mortgage interest is deductible up to the amount of your "acquisition debt." Acquisition debt is money you borrowed to buy the home or make major improvements. Interest on home equity debt is not deductible.
For example, you bought the home for $150,000 and the mortgage was originally $120,000, now paid down to $100,000. You refinance for $150,000. If you don't use any of the money for major home improvements, then you have $100,000 of acquisition debt and $50,000 of equity debt, meaning you can deduct 2/3, or 100000/150000 of the interest.