FreeBSD/sys/arm/ti/ti_pinmux.c
/**
 *	ti_pinmux_padconf_get - gets the muxmode and state for a pad/pin
 *	@padname: the name of the pad, i.e. "c12"
 *	@muxmode: upon return will contain the name of the muxmode of the pin
 *	@state: upon return will contain the state of the pad/pin
 *
 *
 *	LOCKING:
 *	Internally locks it's own context.
 *
 *	RETURNS:
 *	0 on success.
 *	EINVAL if pin requested is outside valid range or already in use.
 */
gets the muxmode and state for a pad/pin
@padname: the name of the pad, i.e. "c12"
@muxmode: upon return will contain the name of the muxmode of the pin
@state: upon return will contain the state of the pad/pin

Internally locks it's own context.

0 on success.
EINVAL if pin requested is outside valid range or already in use.
gets the muxmode and state for a pad / pin @padname : the name of the pad i . e . " c12 " @muxmode : upon return will contain the name of the muxmode of the pin @state : upon return will contain the state of the pad / pin Internally locks it ' s own context . 0 on success . EINVAL if pin requested is outside valid range or already in use .
int
ti_pinmux_padconf_get(const char *padname, const char **muxmode,
    unsigned int *state)
{
	const struct ti_pinmux_padconf *padconf;
	uint16_t reg_val;
	if (!ti_pinmux_sc)
		return (ENXIO);
	padconf = ti_pinmux_padconf_from_name(padname);
	if (padconf == NULL)
		return (EINVAL);
	reg_val = ti_pinmux_read_2(ti_pinmux_sc, padconf->reg_off);
	if (state)
		*state = (reg_val & ti_pinmux_dev.padconf_sate_mask);
	if (muxmode)
		*muxmode = padconf->muxmodes[(reg_val & ti_pinmux_dev.padconf_muxmode_mask)];
	return (0);
}
int ti_pinmux_padconf_get ( const char * padname , const char * * muxmode , unsigned int * state ) { const struct ti_pinmux_padconf * padconf ; uint16_t reg_val ; if ( ! ti_pinmux_sc ) return ( ENXIO ) ; padconf = ti_pinmux_padconf_from_name ( padname ) ; if ( padconf == NULL ) return ( EINVAL ) ; reg_val = ti_pinmux_read_2 ( ti_pinmux_sc , padconf -> reg_off ) ; if ( state ) * state = ( reg_val & ti_pinmux_dev . padconf_sate_mask ) ; if ( muxmode ) * muxmode = padconf -> muxmodes [ ( reg_val & ti_pinmux_dev . padconf_muxmode_mask ) ] ; return ( 0 ) ; }
ti_pinmux_padconf_get - gets the muxmode and state for a pad/pin
      @padname: the name of the pad, i.e.
ti_pinmux_padconf_get - gets the muxmode and state for a pad / pin @padname : the name of the pad i . e .
/* find the pin in the devmap */ /* read the register value (16-bit reads) */ /* save the state */ /* save the mode */