summaryrefslogtreecommitdiff
path: root/linux/drivers/media
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media')
-rw-r--r--linux/drivers/media/dvb/frontends/ves1820.c29
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);