I was watching The Last Samurai and I wondered if proper discipline could have stopped the charge. I was wondering if it could be stopped without the help of pikemen or supporting infantry
EDIT: *Were. Shit.
Prior to the introduction of bayonets and on open terrain, extremely rarely but yes.
Blaise de Montluc provides one example from the early 16th century in which he and a force of about 20 arquebusiers and only a few pikemen were caught out in the open by a party of about 25 enemy cavalry. He writes that he divided his gunmen in two and ordered them so that half would have their weapons loaded at any given time. In this way he was able to keep up fire at a distance, and every time the enemy lancers prepared to charge they were dissuaded by the loaded rank of arquebuses ready to unload into their faces. Later in the 16th century, mercenary Humfrey Barwick gives an account in which a scouting force of 500 French cavalry was intercepted by a much larger troop of Spanish horse. During the retreat, a rearguard of 40 French harquebusiers dismounted to defend a choke point, and this was apparently enough to make the enemy to break off their pursuit without any casualties.
In East Asia there is an interesting example during Battle of Sarhu in 1619 where the Koreans were aiding their Chinese allies with a force of 10,000 musketeers, theoretically trained in countermarch-style volley techniques. In general, discipline broke down during the initial charge and the battle turned into a complete disaster with the exception of the eastern front where a force of 500 Korean musketeers apparently were able to keep up their volley drills and successfully kept the Manchu cavalry at bay with continuous fire until all their allies had surrendered.
Essentially it may have been possible to defeat cavalry with firepower alone assuming the right conditions and extremely disciplined infantry, but the general rule of thumb among military commanders was that shot should never go up against cavalry without a barrier of some sort. For instance a fortification, ditch, hedgerow, etc. Typically the earliest battles that are considered to have been won by firearms were in large part due to good defensive positioning, for instance the Battle of Cerignola where the French cavalry charge was stopped by an unseen ditch, leaving them sitting ducks for the Spanish arquebusiers. At Pavia, the gunmen didn't have any prepared defenses, but rather than hold their ground they scattered to take cover behind random copses of trees and rough ground, defeating the French Gendarmes that way. Eventually a mobile solution was found by attaching the shot directly to large blocks of pikemen, which would form the basis for tactics during the pike and shot era.
Sources:
Montluc, The commentaries of Messire Blaize de Montluc
Barwick, A Breefe Discourse
Kang, "Big Heads and Buddhist Demons: The Korean Musketry Revolution and the Northern Expeditions of 1654 and 1658"
Hall, Weapons and Warfare in Renaissance Europe
Mallett, The Italian Wars, 1494-1559
Tallett, European Warfare 1350-1750