diff options
author | Michael Hunold <devnull@localhost> | 2004-08-09 12:10:41 +0000 |
---|---|---|
committer | Michael Hunold <devnull@localhost> | 2004-08-09 12:10:41 +0000 |
commit | 5bef105ef532abf06a3c0988342548119c1a892f (patch) | |
tree | 8dcd5822821f418a1dfd4b7376dea3d2fc7a9ac9 /linux/drivers/media | |
parent | f9dfc48647ce622a242e378adc45b98de391f7df (diff) | |
download | mediapointer-dvb-s2-5bef105ef532abf06a3c0988342548119c1a892f.tar.gz mediapointer-dvb-s2-5bef105ef532abf06a3c0988342548119c1a892f.tar.bz2 |
- add back per-device pwm setting support, now done via sysfs attributes
1. Locate the pwm setting
> find /sys/|grep "pwm"
/sys/devices/platform/i2c-0/0-0061/pwm
2. Set your desired value
echo "0x5c" > /sys/devices/platform/i2c-0/0-0061/pwm
3. Read the current value
more /sys/devices/platform/i2c-0/0-0061/pwm
Diffstat (limited to 'linux/drivers/media')
-rw-r--r-- | linux/drivers/media/dvb/frontends/ves1820.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/linux/drivers/media/dvb/frontends/ves1820.c b/linux/drivers/media/dvb/frontends/ves1820.c index 7bf168e85..09949c12f 100644 --- a/linux/drivers/media/dvb/frontends/ves1820.c +++ b/linux/drivers/media/dvb/frontends/ves1820.c @@ -33,8 +33,11 @@ #include "dvb_i2c.h" /* I2C_DRIVERID_VES1820 is already defined in i2c-id.h */ + +#if 0 static int debug = 0; #define dprintk if (debug) printk +#endif static int verbose; @@ -484,6 +487,29 @@ static long probe_demod_addr(struct i2c_adapter *i2c) return -1; } +static ssize_t attr_read_pwm(struct device *dev, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct ves1820_state *state = (struct ves1820_state *) i2c_get_clientdata(client); + return sprintf(buf, "0x%02x\n", state->pwm); +} + +static ssize_t attr_write_pwm(struct device *dev, const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct ves1820_state *state = (struct ves1820_state *) i2c_get_clientdata(client); + unsigned long pwm; + pwm = simple_strtoul(buf, NULL, 0); + state->pwm = pwm & 0xff; + return strlen(buf)+1; +} + +static struct device_attribute dev_attr_client_name = { + .attr = { .name = "pwm", .mode = S_IRUGO|S_IWUGO, .owner = THIS_MODULE }, + .show = &attr_read_pwm, + .store = &attr_write_pwm, +}; + static struct i2c_client client_template; static int attach_adapter(struct i2c_adapter *adapter) @@ -536,6 +562,8 @@ static int attach_adapter(struct i2c_adapter *adapter) BUG_ON(!state->dvb); + device_create_file(&client->dev, &dev_attr_client_name); + ret = dvb_register_frontend_new(ves1820_ioctl, state->dvb, state, &ves1820_info, THIS_MODULE); if (ret) { i2c_detach_client(client); @@ -551,6 +579,7 @@ static int detach_client(struct i2c_client *client) { struct ves1820_state *state = (struct ves1820_state *) i2c_get_clientdata(client); dvb_unregister_frontend_new(ves1820_ioctl, state->dvb); + device_remove_file(&client->dev, &dev_attr_client_name); i2c_detach_client(client); BUG_ON(state->dvb); kfree(client); |