Commit c056e1ae authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Russell King

[PCMCIA] card voltage

Patch from Dominik Brodowski

Add an attribute "card_voltage" which returns the card's voltage
requirements:

"5.0V", "3.3V" or "X.XV".
parent c792495f
...@@ -58,8 +58,25 @@ static ssize_t pccard_show_type(struct class_device *dev, char *buf) ...@@ -58,8 +58,25 @@ static ssize_t pccard_show_type(struct class_device *dev, char *buf)
} }
static CLASS_DEVICE_ATTR(card_type, 0400, pccard_show_type, NULL); static CLASS_DEVICE_ATTR(card_type, 0400, pccard_show_type, NULL);
static ssize_t pccard_show_voltage(struct class_device *dev, char *buf)
{
int val;
struct pcmcia_socket *s = to_socket(dev);
if (!(s->state & SOCKET_PRESENT))
return -ENODEV;
s->ops->get_status(s, &val);
if (val & SS_3VCARD)
return sprintf(buf, "3.3V\n");
if (val & SS_XVCARD)
return sprintf(buf, "X.XV\n");
return sprintf(buf, "5.0V\n");
}
static CLASS_DEVICE_ATTR(card_voltage, 0400, pccard_show_voltage, NULL);
static struct class_device_attribute *pccard_socket_attributes[] = { static struct class_device_attribute *pccard_socket_attributes[] = {
&class_device_attr_card_type, &class_device_attr_card_type,
&class_device_attr_card_voltage,
NULL, NULL,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment