aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bt8xx/bttv-driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/bt8xx/bttv-driver.c')
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c355
1 files changed, 178 insertions, 177 deletions
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 30cc2d3ba52d..c8f958151677 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -1442,6 +1442,170 @@ static void bttv_reinit_bt848(struct bttv *btv)
1442 set_input(btv, btv->input, btv->tvnorm); 1442 set_input(btv, btv->input, btv->tvnorm);
1443} 1443}
1444 1444
1445static int bttv_g_ctrl(struct file *file, void *priv,
1446 struct v4l2_control *c)
1447{
1448 struct bttv_fh *fh = priv;
1449 struct bttv *btv = fh->btv;
1450
1451 switch (c->id) {
1452 case V4L2_CID_BRIGHTNESS:
1453 c->value = btv->bright;
1454 break;
1455 case V4L2_CID_HUE:
1456 c->value = btv->hue;
1457 break;
1458 case V4L2_CID_CONTRAST:
1459 c->value = btv->contrast;
1460 break;
1461 case V4L2_CID_SATURATION:
1462 c->value = btv->saturation;
1463 break;
1464
1465 case V4L2_CID_AUDIO_MUTE:
1466 case V4L2_CID_AUDIO_VOLUME:
1467 case V4L2_CID_AUDIO_BALANCE:
1468 case V4L2_CID_AUDIO_BASS:
1469 case V4L2_CID_AUDIO_TREBLE:
1470 bttv_call_i2c_clients(btv, VIDIOC_G_CTRL, c);
1471 break;
1472
1473 case V4L2_CID_PRIVATE_CHROMA_AGC:
1474 c->value = btv->opt_chroma_agc;
1475 break;
1476 case V4L2_CID_PRIVATE_COMBFILTER:
1477 c->value = btv->opt_combfilter;
1478 break;
1479 case V4L2_CID_PRIVATE_LUMAFILTER:
1480 c->value = btv->opt_lumafilter;
1481 break;
1482 case V4L2_CID_PRIVATE_AUTOMUTE:
1483 c->value = btv->opt_automute;
1484 break;
1485 case V4L2_CID_PRIVATE_AGC_CRUSH:
1486 c->value = btv->opt_adc_crush;
1487 break;
1488 case V4L2_CID_PRIVATE_VCR_HACK:
1489 c->value = btv->opt_vcr_hack;
1490 break;
1491 case V4L2_CID_PRIVATE_WHITECRUSH_UPPER:
1492 c->value = btv->opt_whitecrush_upper;
1493 break;
1494 case V4L2_CID_PRIVATE_WHITECRUSH_LOWER:
1495 c->value = btv->opt_whitecrush_lower;
1496 break;
1497 case V4L2_CID_PRIVATE_UV_RATIO:
1498 c->value = btv->opt_uv_ratio;
1499 break;
1500 case V4L2_CID_PRIVATE_FULL_LUMA_RANGE:
1501 c->value = btv->opt_full_luma_range;
1502 break;
1503 case V4L2_CID_PRIVATE_CORING:
1504 c->value = btv->opt_coring;
1505 break;
1506 default:
1507 return -EINVAL;
1508 }
1509 return 0;
1510}
1511
1512static int bttv_s_ctrl(struct file *file, void *f,
1513 struct v4l2_control *c)
1514{
1515 int err;
1516 int val;
1517 struct bttv_fh *fh = f;
1518 struct bttv *btv = fh->btv;
1519
1520 err = v4l2_prio_check(&btv->prio, &fh->prio);
1521 if (0 != err)
1522 return err;
1523
1524 switch (c->id) {
1525 case V4L2_CID_BRIGHTNESS:
1526 bt848_bright(btv, c->value);
1527 break;
1528 case V4L2_CID_HUE:
1529 bt848_hue(btv, c->value);
1530 break;
1531 case V4L2_CID_CONTRAST:
1532 bt848_contrast(btv, c->value);
1533 break;
1534 case V4L2_CID_SATURATION:
1535 bt848_sat(btv, c->value);
1536 break;
1537 case V4L2_CID_AUDIO_MUTE:
1538 audio_mute(btv, c->value);
1539 /* fall through */
1540 case V4L2_CID_AUDIO_VOLUME:
1541 if (btv->volume_gpio)
1542 btv->volume_gpio(btv, c->value);
1543
1544 bttv_call_i2c_clients(btv, VIDIOC_S_CTRL, c);
1545 break;
1546 case V4L2_CID_AUDIO_BALANCE:
1547 case V4L2_CID_AUDIO_BASS:
1548 case V4L2_CID_AUDIO_TREBLE:
1549 bttv_call_i2c_clients(btv, VIDIOC_S_CTRL, c);
1550 break;
1551
1552 case V4L2_CID_PRIVATE_CHROMA_AGC:
1553 btv->opt_chroma_agc = c->value;
1554 val = btv->opt_chroma_agc ? BT848_SCLOOP_CAGC : 0;
1555 btwrite(val, BT848_E_SCLOOP);
1556 btwrite(val, BT848_O_SCLOOP);
1557 break;
1558 case V4L2_CID_PRIVATE_COMBFILTER:
1559 btv->opt_combfilter = c->value;
1560 break;
1561 case V4L2_CID_PRIVATE_LUMAFILTER:
1562 btv->opt_lumafilter = c->value;
1563 if (btv->opt_lumafilter) {
1564 btand(~BT848_CONTROL_LDEC, BT848_E_CONTROL);
1565 btand(~BT848_CONTROL_LDEC, BT848_O_CONTROL);
1566 } else {
1567 btor(BT848_CONTROL_LDEC, BT848_E_CONTROL);
1568 btor(BT848_CONTROL_LDEC, BT848_O_CONTROL);
1569 }
1570 break;
1571 case V4L2_CID_PRIVATE_AUTOMUTE:
1572 btv->opt_automute = c->value;
1573 break;
1574 case V4L2_CID_PRIVATE_AGC_CRUSH:
1575 btv->opt_adc_crush = c->value;
1576 btwrite(BT848_ADC_RESERVED |
1577 (btv->opt_adc_crush ? BT848_ADC_CRUSH : 0),
1578 BT848_ADC);
1579 break;
1580 case V4L2_CID_PRIVATE_VCR_HACK:
1581 btv->opt_vcr_hack = c->value;
1582 break;
1583 case V4L2_CID_PRIVATE_WHITECRUSH_UPPER:
1584 btv->opt_whitecrush_upper = c->value;
1585 btwrite(c->value, BT848_WC_UP);
1586 break;
1587 case V4L2_CID_PRIVATE_WHITECRUSH_LOWER:
1588 btv->opt_whitecrush_lower = c->value;
1589 btwrite(c->value, BT848_WC_DOWN);
1590 break;
1591 case V4L2_CID_PRIVATE_UV_RATIO:
1592 btv->opt_uv_ratio = c->value;
1593 bt848_sat(btv, btv->saturation);
1594 break;
1595 case V4L2_CID_PRIVATE_FULL_LUMA_RANGE:
1596 btv->opt_full_luma_range = c->value;
1597 btaor((c->value<<7), ~BT848_OFORM_RANGE, BT848_OFORM);
1598 break;
1599 case V4L2_CID_PRIVATE_CORING:
1600 btv->opt_coring = c->value;
1601 btaor((c->value<<5), ~BT848_OFORM_CORE32, BT848_OFORM);
1602 break;
1603 default:
1604 return -EINVAL;
1605 }
1606 return 0;
1607}
1608
1445/* ----------------------------------------------------------------------- */ 1609/* ----------------------------------------------------------------------- */
1446 1610
1447void bttv_gpio_tracking(struct bttv *btv, char *comment) 1611void bttv_gpio_tracking(struct bttv *btv, char *comment)
@@ -1869,170 +2033,6 @@ static int bttv_log_status(struct file *file, void *f)
1869 return 0; 2033 return 0;
1870} 2034}
1871 2035
1872static int bttv_g_ctrl(struct file *file, void *priv,
1873 struct v4l2_control *c)
1874{
1875 struct bttv_fh *fh = priv;
1876 struct bttv *btv = fh->btv;
1877
1878 switch (c->id) {
1879 case V4L2_CID_BRIGHTNESS:
1880 c->value = btv->bright;
1881 break;
1882 case V4L2_CID_HUE:
1883 c->value = btv->hue;
1884 break;
1885 case V4L2_CID_CONTRAST:
1886 c->value = btv->contrast;
1887 break;
1888 case V4L2_CID_SATURATION:
1889 c->value = btv->saturation;
1890 break;
1891
1892 case V4L2_CID_AUDIO_MUTE:
1893 case V4L2_CID_AUDIO_VOLUME:
1894 case V4L2_CID_AUDIO_BALANCE:
1895 case V4L2_CID_AUDIO_BASS:
1896 case V4L2_CID_AUDIO_TREBLE:
1897 bttv_call_i2c_clients(btv, VIDIOC_G_CTRL, c);
1898 break;
1899
1900 case V4L2_CID_PRIVATE_CHROMA_AGC:
1901 c->value = btv->opt_chroma_agc;
1902 break;
1903 case V4L2_CID_PRIVATE_COMBFILTER:
1904 c->value = btv->opt_combfilter;
1905 break;
1906 case V4L2_CID_PRIVATE_LUMAFILTER:
1907 c->value = btv->opt_lumafilter;
1908 break;
1909 case V4L2_CID_PRIVATE_AUTOMUTE:
1910 c->value = btv->opt_automute;
1911 break;
1912 case V4L2_CID_PRIVATE_AGC_CRUSH:
1913 c->value = btv->opt_adc_crush;
1914 break;
1915 case V4L2_CID_PRIVATE_VCR_HACK:
1916 c->value = btv->opt_vcr_hack;
1917 break;
1918 case V4L2_CID_PRIVATE_WHITECRUSH_UPPER:
1919 c->value = btv->opt_whitecrush_upper;
1920 break;
1921 case V4L2_CID_PRIVATE_WHITECRUSH_LOWER:
1922 c->value = btv->opt_whitecrush_lower;
1923 break;
1924 case V4L2_CID_PRIVATE_UV_RATIO:
1925 c->value = btv->opt_uv_ratio;
1926 break;
1927 case V4L2_CID_PRIVATE_FULL_LUMA_RANGE:
1928 c->value = btv->opt_full_luma_range;
1929 break;
1930 case V4L2_CID_PRIVATE_CORING:
1931 c->value = btv->opt_coring;
1932 break;
1933 default:
1934 return -EINVAL;
1935 }
1936 return 0;
1937}
1938
1939static int bttv_s_ctrl(struct file *file, void *f,
1940 struct v4l2_control *c)
1941{
1942 int err;
1943 int val;
1944 struct bttv_fh *fh = f;
1945 struct bttv *btv = fh->btv;
1946
1947 err = v4l2_prio_check(&btv->prio, &fh->prio);
1948 if (0 != err)
1949 return err;
1950
1951 switch (c->id) {
1952 case V4L2_CID_BRIGHTNESS:
1953 bt848_bright(btv, c->value);
1954 break;
1955 case V4L2_CID_HUE:
1956 bt848_hue(btv, c->value);
1957 break;
1958 case V4L2_CID_CONTRAST:
1959 bt848_contrast(btv, c->value);
1960 break;
1961 case V4L2_CID_SATURATION:
1962 bt848_sat(btv, c->value);
1963 break;
1964 case V4L2_CID_AUDIO_MUTE:
1965 audio_mute(btv, c->value);
1966 /* fall through */
1967 case V4L2_CID_AUDIO_VOLUME:
1968 if (btv->volume_gpio)
1969 btv->volume_gpio(btv, c->value);
1970
1971 bttv_call_i2c_clients(btv, VIDIOC_S_CTRL, c);
1972 break;
1973 case V4L2_CID_AUDIO_BALANCE:
1974 case V4L2_CID_AUDIO_BASS:
1975 case V4L2_CID_AUDIO_TREBLE:
1976 bttv_call_i2c_clients(btv, VIDIOC_S_CTRL, c);
1977 break;
1978
1979 case V4L2_CID_PRIVATE_CHROMA_AGC:
1980 btv->opt_chroma_agc = c->value;
1981 val = btv->opt_chroma_agc ? BT848_SCLOOP_CAGC : 0;
1982 btwrite(val, BT848_E_SCLOOP);
1983 btwrite(val, BT848_O_SCLOOP);
1984 break;
1985 case V4L2_CID_PRIVATE_COMBFILTER:
1986 btv->opt_combfilter = c->value;
1987 break;
1988 case V4L2_CID_PRIVATE_LUMAFILTER:
1989 btv->opt_lumafilter = c->value;
1990 if (btv->opt_lumafilter) {
1991 btand(~BT848_CONTROL_LDEC, BT848_E_CONTROL);
1992 btand(~BT848_CONTROL_LDEC, BT848_O_CONTROL);
1993 } else {
1994 btor(BT848_CONTROL_LDEC, BT848_E_CONTROL);
1995 btor(BT848_CONTROL_LDEC, BT848_O_CONTROL);
1996 }
1997 break;
1998 case V4L2_CID_PRIVATE_AUTOMUTE:
1999 btv->opt_automute = c->value;
2000 break;
2001 case V4L2_CID_PRIVATE_AGC_CRUSH:
2002 btv->opt_adc_crush = c->value;
2003 btwrite(BT848_ADC_RESERVED |
2004 (btv->opt_adc_crush ? BT848_ADC_CRUSH : 0),
2005 BT848_ADC);
2006 break;
2007 case V4L2_CID_PRIVATE_VCR_HACK:
2008 btv->opt_vcr_hack = c->value;
2009 break;
2010 case V4L2_CID_PRIVATE_WHITECRUSH_UPPER:
2011 btv->opt_whitecrush_upper = c->value;
2012 btwrite(c->value, BT848_WC_UP);
2013 break;
2014 case V4L2_CID_PRIVATE_WHITECRUSH_LOWER:
2015 btv->opt_whitecrush_lower = c->value;
2016 btwrite(c->value, BT848_WC_DOWN);
2017 break;
2018 case V4L2_CID_PRIVATE_UV_RATIO:
2019 btv->opt_uv_ratio = c->value;
2020 bt848_sat(btv, btv->saturation);
2021 break;
2022 case V4L2_CID_PRIVATE_FULL_LUMA_RANGE:
2023 btv->opt_full_luma_range = c->value;
2024 btaor((c->value<<7), ~BT848_OFORM_RANGE, BT848_OFORM);
2025 break;
2026 case V4L2_CID_PRIVATE_CORING:
2027 btv->opt_coring = c->value;
2028 btaor((c->value<<5), ~BT848_OFORM_CORE32, BT848_OFORM);
2029 break;
2030 default:
2031 return -EINVAL;
2032 }
2033 return 0;
2034}
2035
2036#ifdef CONFIG_VIDEO_ADV_DEBUG 2036#ifdef CONFIG_VIDEO_ADV_DEBUG
2037static int bttv_g_register(struct file *file, void *f, 2037static int bttv_g_register(struct file *file, void *f,
2038 struct v4l2_register *reg) 2038 struct v4l2_register *reg)
@@ -2633,13 +2633,26 @@ static int bttv_querycap(struct file *file, void *priv,
2633 return 0; 2633 return 0;
2634} 2634}
2635 2635
2636static int bttv_enum_fmt_vbi(struct file *file, void *priv,
2637 struct v4l2_fmtdesc *f)
2638{
2639 if (0 != f->index)
2640 return -EINVAL;
2641
2642 f->pixelformat = V4L2_PIX_FMT_GREY;
2643 strcpy(f->description, "vbi data");
2644
2645 return 0;
2646}
2647
2636static int bttv_enum_fmt_cap(struct file *file, void *priv, 2648static int bttv_enum_fmt_cap(struct file *file, void *priv,
2637 struct v4l2_fmtdesc *f) 2649 struct v4l2_fmtdesc *f)
2638{ 2650{
2639 if (f->index >= FORMATS) 2651 if (f->index >= FORMATS)
2640 return -EINVAL; 2652 return -EINVAL;
2641 2653
2642 strlcpy(f->description, formats[f->index].name, sizeof(f->description)); 2654 strlcpy(f->description, formats[f->index].name,
2655 sizeof(f->description));
2643 f->pixelformat = formats[f->index].fourcc; 2656 f->pixelformat = formats[f->index].fourcc;
2644 2657
2645 return 0; 2658 return 0;
@@ -2664,18 +2677,6 @@ static int bttv_enum_fmt_overlay(struct file *file, void *priv,
2664 return 0; 2677 return 0;
2665} 2678}
2666 2679
2667static int bttv_enum_fmt_vbi(struct file *file, void *priv,
2668 struct v4l2_fmtdesc *f)
2669{
2670 if (0 != f->index)
2671 return -EINVAL;
2672
2673 f->pixelformat = V4L2_PIX_FMT_GREY;
2674 strcpy(f->description, "vbi data");
2675
2676 return 0;
2677}
2678
2679static int bttv_g_fbuf(struct file *file, void *f, 2680static int bttv_g_fbuf(struct file *file, void *f,
2680 struct v4l2_framebuffer *fb) 2681 struct v4l2_framebuffer *fb)
2681{ 2682{