Lines Matching defs:info

562 	struct ov7670_info *info = to_state(sd);
564 if (info->use_smbus)
573 struct ov7670_info *info = to_state(sd);
575 if (info->use_smbus)
701 * Then there is the issue of window sizes. Try to capture the info here.
797 struct ov7670_info *info = to_state(sd);
798 u32 clkrc = info->clkrc;
801 if (info->pll_bypass)
807 if (info->fmt->mbus_code == MEDIA_BUS_FMT_SBGGR8_1X8)
811 tpf->denominator = (5 * pll_factor * info->clock_speed) /
817 struct ov7670_info *info = to_state(sd);
820 ret = ov7670_write(sd, REG_CLKRC, info->clkrc);
825 info->pll_bypass ? DBLV_BYPASS : DBLV_X4);
831 struct ov7670_info *info = to_state(sd);
845 pll_factor = info->pll_bypass ? 1 : PLL_FACTOR;
846 clkrc = (5 * pll_factor * info->clock_speed * tpf->numerator) /
848 if (info->fmt->mbus_code == MEDIA_BUS_FMT_SBGGR8_1X8)
862 info->clkrc = clkrc;
872 if (info->on)
881 struct ov7670_info *info = to_state(sd);
884 tpf->denominator = info->clock_speed;
885 if ((info->clkrc & CLK_EXT) == 0 && (info->clkrc & CLK_SCALE) > 1)
886 tpf->denominator /= (info->clkrc & CLK_SCALE);
892 struct ov7670_info *info = to_state(sd);
898 div = (tpf->numerator * info->clock_speed) / tpf->denominator;
903 info->clkrc = (info->clkrc & 0x80) | div;
905 tpf->denominator = info->clock_speed / div;
912 if (info->on)
913 return ov7670_write(sd, REG_CLKRC, info->clkrc);
979 struct ov7670_info *info = to_state(sd);
980 unsigned int n_win_sizes = info->devtype->n_win_sizes;
1002 if (info->min_width || info->min_height)
1004 wsize = info->devtype->win_sizes + i;
1006 if (wsize->width < info->min_width ||
1007 wsize->height < info->min_height) {
1016 for (wsize = info->devtype->win_sizes;
1017 wsize < info->devtype->win_sizes + win_sizes_limit; wsize++)
1020 if (wsize >= info->devtype->win_sizes + win_sizes_limit)
1031 info->format = *fmt;
1038 struct ov7670_info *info = to_state(sd);
1039 struct ov7670_win_size *wsize = info->wsize;
1049 com7 = info->fmt->regs[0].value;
1058 if (info->mbus_config & V4L2_MBUS_VSYNC_ACTIVE_LOW)
1060 if (info->mbus_config & V4L2_MBUS_HSYNC_ACTIVE_LOW)
1062 if (info->pclk_hb_disable)
1071 ret = ov7670_write_array(sd, info->fmt->regs + 1);
1096 ret = ov7670_write(sd, REG_CLKRC, info->clkrc);
1110 struct ov7670_info *info = to_state(sd);
1131 ret = ov7670_try_fmt_internal(sd, &format->format, &info->fmt, &info->wsize);
1140 if (info->on)
1150 struct ov7670_info *info = to_state(sd);
1164 format->format = info->format;
1177 struct ov7670_info *info = to_state(sd);
1180 info->devtype->get_framerate(sd, &ival->interval);
1189 struct ov7670_info *info = to_state(sd);
1192 return info->devtype->set_framerate(sd, tpf);
1208 struct ov7670_info *info = to_state(sd);
1209 unsigned int n_win_sizes = info->devtype->n_win_sizes;
1224 struct ov7670_win_size *win = &info->devtype->win_sizes[i];
1226 if (info->min_width && win->width < info->min_width)
1228 if (info->min_height && win->height < info->min_height)
1247 struct ov7670_info *info = to_state(sd);
1251 unsigned int n_win_sizes = info->devtype->n_win_sizes;
1261 struct ov7670_win_size *win = &info->devtype->win_sizes[i];
1263 if (info->min_width && win->width < info->min_width)
1265 if (info->min_height && win->height < info->min_height)
1365 static void ov7670_calc_cmatrix(struct ov7670_info *info,
1373 matrix[i] = (info->fmt->cmatrix[i] * sat) >> 7;
1397 struct ov7670_info *info = to_state(sd);
1400 ov7670_calc_cmatrix(info, matrix, sat, hue);
1582 struct ov7670_info *info = to_state(sd);
1586 return ov7670_g_gain(sd, &info->gain->val);
1594 struct ov7670_info *info = to_state(sd);
1603 info->saturation->val, info->hue->val);
1613 return ov7670_s_gain(sd, info->gain->val);
1621 return ov7670_s_exp(sd, info->exposure->val);
1656 struct ov7670_info *info = to_state(sd);
1658 if (info->on)
1661 clk_prepare_enable(info->clk);
1663 if (info->pwdn_gpio)
1664 gpiod_set_value(info->pwdn_gpio, 0);
1665 if (info->resetb_gpio) {
1666 gpiod_set_value(info->resetb_gpio, 1);
1668 gpiod_set_value(info->resetb_gpio, 0);
1670 if (info->pwdn_gpio || info->resetb_gpio || info->clk)
1673 info->on = true;
1678 struct ov7670_info *info = to_state(sd);
1680 if (!info->on)
1683 clk_disable_unprepare(info->clk);
1685 if (info->pwdn_gpio)
1686 gpiod_set_value(info->pwdn_gpio, 1);
1688 info->on = false;
1693 struct ov7670_info *info = to_state(sd);
1695 if (info->on == on)
1703 v4l2_ctrl_handler_setup(&info->hdl);
1714 struct ov7670_info *info = to_state(sd);
1716 format->width = info->devtype->win_sizes[0].width;
1717 format->height = info->devtype->win_sizes[0].height;
1718 format->colorspace = info->fmt->colorspace;
1719 format->code = info->fmt->mbus_code;
1792 static int ov7670_init_gpio(struct i2c_client *client, struct ov7670_info *info)
1794 info->pwdn_gpio = devm_gpiod_get_optional(&client->dev, "powerdown",
1796 if (IS_ERR(info->pwdn_gpio)) {
1798 return PTR_ERR(info->pwdn_gpio);
1801 info->resetb_gpio = devm_gpiod_get_optional(&client->dev, "reset",
1803 if (IS_ERR(info->resetb_gpio)) {
1805 return PTR_ERR(info->resetb_gpio);
1818 struct ov7670_info *info)
1828 info->pclk_hb_disable = false;
1830 info->pclk_hb_disable = true;
1845 info->mbus_config = bus_cfg.bus.parallel.flags;
1855 struct ov7670_info *info;
1858 info = devm_kzalloc(&client->dev, sizeof(*info), GFP_KERNEL);
1859 if (info == NULL)
1861 sd = &info->sd;
1869 info->clock_speed = 30; /* default: a guess */
1872 ret = ov7670_parse_dt(&client->dev, info);
1883 info->min_width = config->min_width;
1884 info->min_height = config->min_height;
1885 info->use_smbus = config->use_smbus;
1888 info->clock_speed = config->clock_speed;
1891 info->pll_bypass = true;
1894 info->pclk_hb_disable = true;
1897 info->clk = devm_clk_get_optional(&client->dev, "xclk");
1898 if (IS_ERR(info->clk))
1899 return PTR_ERR(info->clk);
1901 ret = ov7670_init_gpio(client, info);
1907 if (info->clk) {
1908 info->clock_speed = clk_get_rate(info->clk) / 1000000;
1909 if (info->clock_speed < 10 || info->clock_speed > 48) {
1926 info->devtype = &ov7670_devdata[id->driver_data];
1927 info->fmt = &ov7670_formats[0];
1928 info->wsize = &info->devtype->win_sizes[0];
1930 ov7670_get_default_format(sd, &info->format);
1932 info->clkrc = 0;
1937 info->devtype->set_framerate(sd, &tpf);
1939 v4l2_ctrl_handler_init(&info->hdl, 10);
1940 v4l2_ctrl_new_std(&info->hdl, &ov7670_ctrl_ops,
1942 v4l2_ctrl_new_std(&info->hdl, &ov7670_ctrl_ops,
1944 v4l2_ctrl_new_std(&info->hdl, &ov7670_ctrl_ops,
1946 v4l2_ctrl_new_std(&info->hdl, &ov7670_ctrl_ops,
1948 info->saturation = v4l2_ctrl_new_std(&info->hdl, &ov7670_ctrl_ops,
1950 info->hue = v4l2_ctrl_new_std(&info->hdl, &ov7670_ctrl_ops,
1952 info->gain = v4l2_ctrl_new_std(&info->hdl, &ov7670_ctrl_ops,
1954 info->auto_gain = v4l2_ctrl_new_std(&info->hdl, &ov7670_ctrl_ops,
1956 info->exposure = v4l2_ctrl_new_std(&info->hdl, &ov7670_ctrl_ops,
1958 info->auto_exposure = v4l2_ctrl_new_std_menu(&info->hdl, &ov7670_ctrl_ops,
1961 v4l2_ctrl_new_std_menu_items(&info->hdl, &ov7670_ctrl_ops,
1965 sd->ctrl_handler = &info->hdl;
1966 if (info->hdl.error) {
1967 ret = info->hdl.error;
1975 v4l2_ctrl_auto_cluster(2, &info->auto_gain, 0, true);
1976 v4l2_ctrl_auto_cluster(2, &info->auto_exposure,
1978 v4l2_ctrl_cluster(2, &info->saturation);
1981 info->pad.flags = MEDIA_PAD_FL_SOURCE;
1982 info->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
1983 ret = media_entity_pads_init(&info->sd.entity, 1, &info->pad);
1988 v4l2_ctrl_handler_setup(&info->hdl);
1990 ret = v4l2_async_register_subdev(&info->sd);
1998 media_entity_cleanup(&info->sd.entity);
2000 v4l2_ctrl_handler_free(&info->hdl);
2009 struct ov7670_info *info = to_state(sd);
2012 v4l2_ctrl_handler_free(&info->hdl);
2013 media_entity_cleanup(&info->sd.entity);