JS says he learned about the Godhead from papyrus in his house.
Joseph Smith, Discourse, June 16, 1844, The Joseph Smith Papers website, accessed July 19, 2021
then we shall see as we are seen & be as God— & be as the God of his Far.— I want to reason— I learned it by translating the papyrus now in my house— I learned a test. concerning Abraham & he reasoned concerng. the God of Heaven— in order to do that s[ai]d. he— suppose we have two facts that supposes that anor. fact may exist two men on the earth— one wiser that the other— wod. shew that anor. who is wiser than the wisest may exist— intelligences exist one above anor. that there is no end to it— if Abra[ha][m]. reasoned thus—