Lines Matching refs:info
563 struct ov7670_info *info = to_state(sd);
564 if (info->use_smbus)
573 struct ov7670_info *info = to_state(sd);
574 if (info->use_smbus)
699 * Then there is the issue of window sizes. Try to capture the info here.
795 struct ov7670_info *info = to_state(sd);
796 u32 clkrc = info->clkrc;
799 if (info->pll_bypass)
805 if (info->fmt->mbus_code == MEDIA_BUS_FMT_SBGGR8_1X8)
809 tpf->denominator = (5 * pll_factor * info->clock_speed) /
815 struct ov7670_info *info = to_state(sd);
818 ret = ov7670_write(sd, REG_CLKRC, info->clkrc);
823 info->pll_bypass ? DBLV_BYPASS : DBLV_X4);
829 struct ov7670_info *info = to_state(sd);
843 pll_factor = info->pll_bypass ? 1 : PLL_FACTOR;
844 clkrc = (5 * pll_factor * info->clock_speed * tpf->numerator) /
846 if (info->fmt->mbus_code == MEDIA_BUS_FMT_SBGGR8_1X8)
860 info->clkrc = clkrc;
870 if (info->on)
879 struct ov7670_info *info = to_state(sd);
882 tpf->denominator = info->clock_speed;
883 if ((info->clkrc & CLK_EXT) == 0 && (info->clkrc & CLK_SCALE) > 1)
884 tpf->denominator /= (info->clkrc & CLK_SCALE);
890 struct ov7670_info *info = to_state(sd);
896 div = (tpf->numerator * info->clock_speed) / tpf->denominator;
901 info->clkrc = (info->clkrc & 0x80) | div;
903 tpf->denominator = info->clock_speed / div;
910 if (info->on)
911 return ov7670_write(sd, REG_CLKRC, info->clkrc);
966 struct ov7670_info *info = to_state(sd);
967 unsigned int n_win_sizes = info->devtype->n_win_sizes;
989 if (info->min_width || info->min_height)
991 wsize = info->devtype->win_sizes + i;
993 if (wsize->width < info->min_width ||
994 wsize->height < info->min_height) {
1003 for (wsize = info->devtype->win_sizes;
1004 wsize < info->devtype->win_sizes + win_sizes_limit; wsize++)
1007 if (wsize >= info->devtype->win_sizes + win_sizes_limit)
1018 info->format = *fmt;
1025 struct ov7670_info *info = to_state(sd);
1026 struct ov7670_win_size *wsize = info->wsize;
1036 com7 = info->fmt->regs[0].value;
1045 if (info->mbus_config & V4L2_MBUS_VSYNC_ACTIVE_LOW)
1047 if (info->mbus_config & V4L2_MBUS_HSYNC_ACTIVE_LOW)
1049 if (info->pclk_hb_disable)
1058 ret = ov7670_write_array(sd, info->fmt->regs + 1);
1083 ret = ov7670_write(sd, REG_CLKRC, info->clkrc);
1097 struct ov7670_info *info = to_state(sd);
1117 ret = ov7670_try_fmt_internal(sd, &format->format, &info->fmt, &info->wsize);
1126 if (info->on)
1136 struct ov7670_info *info = to_state(sd);
1150 format->format = info->format;
1163 struct ov7670_info *info = to_state(sd);
1166 info->devtype->get_framerate(sd, &ival->interval);
1175 struct ov7670_info *info = to_state(sd);
1178 return info->devtype->set_framerate(sd, tpf);
1194 struct ov7670_info *info = to_state(sd);
1195 unsigned int n_win_sizes = info->devtype->n_win_sizes;
1210 struct ov7670_win_size *win = &info->devtype->win_sizes[i];
1212 if (info->min_width && win->width < info->min_width)
1214 if (info->min_height && win->height < info->min_height)
1233 struct ov7670_info *info = to_state(sd);
1237 unsigned int n_win_sizes = info->devtype->n_win_sizes;
1247 struct ov7670_win_size *win = &info->devtype->win_sizes[i];
1248 if (info->min_width && win->width < info->min_width)
1250 if (info->min_height && win->height < info->min_height)
1350 static void ov7670_calc_cmatrix(struct ov7670_info *info,
1358 matrix[i] = (info->fmt->cmatrix[i] * sat) >> 7;
1382 struct ov7670_info *info = to_state(sd);
1386 ov7670_calc_cmatrix(info, matrix, sat, hue);
1566 struct ov7670_info *info = to_state(sd);
1570 return ov7670_g_gain(sd, &info->gain->val);
1578 struct ov7670_info *info = to_state(sd);
1587 info->saturation->val, info->hue->val);
1597 return ov7670_s_gain(sd, info->gain->val);
1605 return ov7670_s_exp(sd, info->exposure->val);
1640 struct ov7670_info *info = to_state(sd);
1642 if (info->on)
1645 clk_prepare_enable(info->clk);
1647 if (info->pwdn_gpio)
1648 gpiod_set_value(info->pwdn_gpio, 0);
1649 if (info->resetb_gpio) {
1650 gpiod_set_value(info->resetb_gpio, 1);
1652 gpiod_set_value(info->resetb_gpio, 0);
1654 if (info->pwdn_gpio || info->resetb_gpio || info->clk)
1657 info->on = true;
1662 struct ov7670_info *info = to_state(sd);
1664 if (!info->on)
1667 clk_disable_unprepare(info->clk);
1669 if (info->pwdn_gpio)
1670 gpiod_set_value(info->pwdn_gpio, 1);
1672 info->on = false;
1677 struct ov7670_info *info = to_state(sd);
1679 if (info->on == on)
1687 v4l2_ctrl_handler_setup(&info->hdl);
1698 struct ov7670_info *info = to_state(sd);
1700 format->width = info->devtype->win_sizes[0].width;
1701 format->height = info->devtype->win_sizes[0].height;
1702 format->colorspace = info->fmt->colorspace;
1703 format->code = info->fmt->mbus_code;
1776 static int ov7670_init_gpio(struct i2c_client *client, struct ov7670_info *info)
1778 info->pwdn_gpio = devm_gpiod_get_optional(&client->dev, "powerdown",
1780 if (IS_ERR(info->pwdn_gpio)) {
1782 return PTR_ERR(info->pwdn_gpio);
1785 info->resetb_gpio = devm_gpiod_get_optional(&client->dev, "reset",
1787 if (IS_ERR(info->resetb_gpio)) {
1789 return PTR_ERR(info->resetb_gpio);
1802 struct ov7670_info *info)
1812 info->pclk_hb_disable = false;
1814 info->pclk_hb_disable = true;
1829 info->mbus_config = bus_cfg.bus.parallel.flags;
1839 struct ov7670_info *info;
1842 info = devm_kzalloc(&client->dev, sizeof(*info), GFP_KERNEL);
1843 if (info == NULL)
1845 sd = &info->sd;
1853 info->clock_speed = 30; /* default: a guess */
1856 ret = ov7670_parse_dt(&client->dev, info);
1867 info->min_width = config->min_width;
1868 info->min_height = config->min_height;
1869 info->use_smbus = config->use_smbus;
1872 info->clock_speed = config->clock_speed;
1875 info->pll_bypass = true;
1878 info->pclk_hb_disable = true;
1881 info->clk = devm_clk_get(&client->dev, "xclk"); /* optional */
1882 if (IS_ERR(info->clk)) {
1883 ret = PTR_ERR(info->clk);
1885 info->clk = NULL;
1890 ret = ov7670_init_gpio(client, info);
1896 if (info->clk) {
1897 info->clock_speed = clk_get_rate(info->clk) / 1000000;
1898 if (info->clock_speed < 10 || info->clock_speed > 48) {
1915 info->devtype = &ov7670_devdata[id->driver_data];
1916 info->fmt = &ov7670_formats[0];
1917 info->wsize = &info->devtype->win_sizes[0];
1919 ov7670_get_default_format(sd, &info->format);
1921 info->clkrc = 0;
1926 info->devtype->set_framerate(sd, &tpf);
1928 v4l2_ctrl_handler_init(&info->hdl, 10);
1929 v4l2_ctrl_new_std(&info->hdl, &ov7670_ctrl_ops,
1931 v4l2_ctrl_new_std(&info->hdl, &ov7670_ctrl_ops,
1933 v4l2_ctrl_new_std(&info->hdl, &ov7670_ctrl_ops,
1935 v4l2_ctrl_new_std(&info->hdl, &ov7670_ctrl_ops,
1937 info->saturation = v4l2_ctrl_new_std(&info->hdl, &ov7670_ctrl_ops,
1939 info->hue = v4l2_ctrl_new_std(&info->hdl, &ov7670_ctrl_ops,
1941 info->gain = v4l2_ctrl_new_std(&info->hdl, &ov7670_ctrl_ops,
1943 info->auto_gain = v4l2_ctrl_new_std(&info->hdl, &ov7670_ctrl_ops,
1945 info->exposure = v4l2_ctrl_new_std(&info->hdl, &ov7670_ctrl_ops,
1947 info->auto_exposure = v4l2_ctrl_new_std_menu(&info->hdl, &ov7670_ctrl_ops,
1950 v4l2_ctrl_new_std_menu_items(&info->hdl, &ov7670_ctrl_ops,
1954 sd->ctrl_handler = &info->hdl;
1955 if (info->hdl.error) {
1956 ret = info->hdl.error;
1964 v4l2_ctrl_auto_cluster(2, &info->auto_gain, 0, true);
1965 v4l2_ctrl_auto_cluster(2, &info->auto_exposure,
1967 v4l2_ctrl_cluster(2, &info->saturation);
1970 info->pad.flags = MEDIA_PAD_FL_SOURCE;
1971 info->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
1972 ret = media_entity_pads_init(&info->sd.entity, 1, &info->pad);
1977 v4l2_ctrl_handler_setup(&info->hdl);
1979 ret = v4l2_async_register_subdev(&info->sd);
1987 media_entity_cleanup(&info->sd.entity);
1989 v4l2_ctrl_handler_free(&info->hdl);
1998 struct ov7670_info *info = to_state(sd);
2001 v4l2_ctrl_handler_free(&info->hdl);
2002 media_entity_cleanup(&info->sd.entity);