Substrate discrimination of the chaperone BiP by autonomous and cochaperone-regulated conformational transitions