| .. | .. |
|---|
| 18 | 18 | #include <linux/module.h> |
|---|
| 19 | 19 | #include <linux/of_graph.h> |
|---|
| 20 | 20 | #include <linux/rk-camera-module.h> |
|---|
| 21 | +#include <linux/rk_hdmirx_class.h> |
|---|
| 21 | 22 | #include <linux/slab.h> |
|---|
| 22 | 23 | #include <linux/timer.h> |
|---|
| 23 | 24 | #include <linux/v4l2-dv-timings.h> |
|---|
| .. | .. |
|---|
| 89 | 90 | u32 module_index; |
|---|
| 90 | 91 | u32 csi_lanes_in_use; |
|---|
| 91 | 92 | u32 audio_sampling_rate; |
|---|
| 93 | + struct device *classdev; |
|---|
| 92 | 94 | }; |
|---|
| 93 | 95 | |
|---|
| 94 | 96 | struct lt6911uxc_mode { |
|---|
| .. | .. |
|---|
| 1279 | 1281 | } |
|---|
| 1280 | 1282 | #endif |
|---|
| 1281 | 1283 | |
|---|
| 1284 | +static ssize_t audio_rate_show(struct device *dev, |
|---|
| 1285 | + struct device_attribute *attr, char *buf) |
|---|
| 1286 | +{ |
|---|
| 1287 | + struct lt6911uxc *lt6911uxc = dev_get_drvdata(dev); |
|---|
| 1288 | + |
|---|
| 1289 | + return snprintf(buf, PAGE_SIZE, "%d", lt6911uxc->audio_sampling_rate); |
|---|
| 1290 | +} |
|---|
| 1291 | + |
|---|
| 1292 | +static ssize_t audio_present_show(struct device *dev, |
|---|
| 1293 | + struct device_attribute *attr, char *buf) |
|---|
| 1294 | +{ |
|---|
| 1295 | + struct lt6911uxc *lt6911uxc = dev_get_drvdata(dev); |
|---|
| 1296 | + |
|---|
| 1297 | + return snprintf(buf, PAGE_SIZE, "%d", |
|---|
| 1298 | + tx_5v_power_present(<6911uxc->sd) ? |
|---|
| 1299 | + lt6911uxc->is_audio_present : 0); |
|---|
| 1300 | +} |
|---|
| 1301 | + |
|---|
| 1302 | +static DEVICE_ATTR_RO(audio_rate); |
|---|
| 1303 | +static DEVICE_ATTR_RO(audio_present); |
|---|
| 1304 | + |
|---|
| 1305 | +static struct attribute *lt6911_attrs[] = { |
|---|
| 1306 | + &dev_attr_audio_rate.attr, |
|---|
| 1307 | + &dev_attr_audio_present.attr, |
|---|
| 1308 | + NULL |
|---|
| 1309 | +}; |
|---|
| 1310 | +ATTRIBUTE_GROUPS(lt6911); |
|---|
| 1311 | + |
|---|
| 1282 | 1312 | static int lt6911uxc_probe(struct i2c_client *client, |
|---|
| 1283 | 1313 | const struct i2c_device_id *id) |
|---|
| 1284 | 1314 | { |
|---|
| .. | .. |
|---|
| 1355 | 1385 | goto err_clean_entity; |
|---|
| 1356 | 1386 | } |
|---|
| 1357 | 1387 | |
|---|
| 1388 | + lt6911uxc->classdev = device_create_with_groups(rk_hdmirx_class(), |
|---|
| 1389 | + dev, MKDEV(0, 0), |
|---|
| 1390 | + lt6911uxc, |
|---|
| 1391 | + lt6911_groups, |
|---|
| 1392 | + "lt6911"); |
|---|
| 1393 | + if (IS_ERR(lt6911uxc->classdev)) |
|---|
| 1394 | + goto err_clean_entity; |
|---|
| 1395 | + |
|---|
| 1358 | 1396 | INIT_DELAYED_WORK(<6911uxc->delayed_work_enable_hotplug, |
|---|
| 1359 | 1397 | lt6911uxc_delayed_work_enable_hotplug); |
|---|
| 1360 | 1398 | INIT_DELAYED_WORK(<6911uxc->delayed_work_res_change, |
|---|