Lines Matching refs:client

131 #define reg_read(reg) mt9m111_reg_read(client, MT9M111_##reg)
132 #define reg_write(reg, val) mt9m111_reg_write(client, MT9M111_##reg, (val))
133 #define reg_set(reg, val) mt9m111_reg_set(client, MT9M111_##reg, (val))
134 #define reg_clear(reg, val) mt9m111_reg_clear(client, MT9M111_##reg, (val))
135 #define reg_mask(reg, val, mask) mt9m111_reg_mask(client, MT9M111_##reg, \
231 static struct mt9m111 *to_mt9m111(const struct i2c_client *client) in to_mt9m111() argument
233 return container_of(i2c_get_clientdata(client), struct mt9m111, subdev); in to_mt9m111()
236 static int reg_page_map_set(struct i2c_client *client, const u16 reg) in reg_page_map_set() argument
240 struct mt9m111 *mt9m111 = to_mt9m111(client); in reg_page_map_set()
248 ret = i2c_smbus_write_word_swapped(client, MT9M111_PAGE_MAP, page); in reg_page_map_set()
254 static int mt9m111_reg_read(struct i2c_client *client, const u16 reg) in mt9m111_reg_read() argument
258 ret = reg_page_map_set(client, reg); in mt9m111_reg_read()
260 ret = i2c_smbus_read_word_swapped(client, reg & 0xff); in mt9m111_reg_read()
262 dev_dbg(&client->dev, "read reg.%03x -> %04x\n", reg, ret); in mt9m111_reg_read()
266 static int mt9m111_reg_write(struct i2c_client *client, const u16 reg, in mt9m111_reg_write() argument
271 ret = reg_page_map_set(client, reg); in mt9m111_reg_write()
273 ret = i2c_smbus_write_word_swapped(client, reg & 0xff, data); in mt9m111_reg_write()
274 dev_dbg(&client->dev, "write reg.%03x = %04x -> %d\n", reg, data, ret); in mt9m111_reg_write()
278 static int mt9m111_reg_set(struct i2c_client *client, const u16 reg, in mt9m111_reg_set() argument
283 ret = mt9m111_reg_read(client, reg); in mt9m111_reg_set()
285 ret = mt9m111_reg_write(client, reg, ret | data); in mt9m111_reg_set()
289 static int mt9m111_reg_clear(struct i2c_client *client, const u16 reg, in mt9m111_reg_clear() argument
294 ret = mt9m111_reg_read(client, reg); in mt9m111_reg_clear()
296 ret = mt9m111_reg_write(client, reg, ret & ~data); in mt9m111_reg_clear()
300 static int mt9m111_reg_mask(struct i2c_client *client, const u16 reg, in mt9m111_reg_mask() argument
305 ret = mt9m111_reg_read(client, reg); in mt9m111_reg_mask()
307 ret = mt9m111_reg_write(client, reg, (ret & ~mask) | data); in mt9m111_reg_mask()
314 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_context() local
322 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_setup_rect_ctx() local
323 int ret = mt9m111_reg_write(client, ctx->reducer_xzoom, rect->width); in mt9m111_setup_rect_ctx()
325 ret = mt9m111_reg_write(client, ctx->reducer_yzoom, rect->height); in mt9m111_setup_rect_ctx()
327 ret = mt9m111_reg_write(client, ctx->reducer_xsize, width); in mt9m111_setup_rect_ctx()
329 ret = mt9m111_reg_write(client, ctx->reducer_ysize, height); in mt9m111_setup_rect_ctx()
336 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_setup_geometry() local
358 dev_dbg(&client->dev, "%s(%x): %ux%u@%u:%u -> %ux%u = %d\n", in mt9m111_setup_geometry()
367 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_enable() local
373 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_reset() local
467 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_pixfmt() local
521 dev_err(&client->dev, "Pixel format not handled: %x\n", code); in mt9m111_set_pixfmt()
525 ret = mt9m111_reg_mask(client, context_a.output_fmt_ctrl2, in mt9m111_set_pixfmt()
528 ret = mt9m111_reg_mask(client, context_b.output_fmt_ctrl2, in mt9m111_set_pixfmt()
537 struct i2c_client *client = v4l2_get_subdevdata(sd); in mt9m111_try_fmt() local
569 dev_dbg(&client->dev, "%s(): %ux%u, code=%x\n", __func__, in mt9m111_try_fmt()
606 struct i2c_client *client = v4l2_get_subdevdata(sd); in mt9m111_g_register() local
612 val = mt9m111_reg_read(client, reg->reg); in mt9m111_g_register()
625 struct i2c_client *client = v4l2_get_subdevdata(sd); in mt9m111_s_register() local
630 if (mt9m111_reg_write(client, reg->reg, reg->val) < 0) in mt9m111_s_register()
639 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_flip() local
643 ret = mt9m111_reg_set(client, mt9m111->ctx->read_mode, mask); in mt9m111_set_flip()
645 ret = mt9m111_reg_clear(client, mt9m111->ctx->read_mode, mask); in mt9m111_set_flip()
652 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_get_global_gain() local
664 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_global_gain() local
682 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_autoexposure() local
691 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_autowhitebalance() local
723 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_suspend() local
761 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_init() local
770 dev_err(&client->dev, "mt9m111 init failed: %d\n", ret); in mt9m111_init()
776 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_power_on() local
777 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); in mt9m111_power_on()
780 ret = soc_camera_power_on(&client->dev, ssdd, mt9m111->clk); in mt9m111_power_on()
786 dev_err(&client->dev, "Failed to resume the sensor: %d\n", ret); in mt9m111_power_on()
787 soc_camera_power_off(&client->dev, ssdd, mt9m111->clk); in mt9m111_power_on()
795 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_power_off() local
796 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); in mt9m111_power_off()
799 soc_camera_power_off(&client->dev, ssdd, mt9m111->clk); in mt9m111_power_off()
855 struct i2c_client *client = v4l2_get_subdevdata(sd); in mt9m111_g_mbus_config() local
856 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); in mt9m111_g_mbus_config()
887 static int mt9m111_video_probe(struct i2c_client *client) in mt9m111_video_probe() argument
889 struct mt9m111 *mt9m111 = to_mt9m111(client); in mt9m111_video_probe()
901 dev_info(&client->dev, in mt9m111_video_probe()
905 dev_info(&client->dev, "Detected a MT9M112 chip ID %x\n", data); in mt9m111_video_probe()
908 dev_err(&client->dev, in mt9m111_video_probe()
926 static int mt9m111_probe(struct i2c_client *client, in mt9m111_probe() argument
930 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); in mt9m111_probe()
931 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); in mt9m111_probe()
934 if (client->dev.of_node) { in mt9m111_probe()
935 ssdd = devm_kzalloc(&client->dev, sizeof(*ssdd), GFP_KERNEL); in mt9m111_probe()
938 client->dev.platform_data = ssdd; in mt9m111_probe()
941 dev_err(&client->dev, "mt9m111: driver needs platform data\n"); in mt9m111_probe()
951 mt9m111 = devm_kzalloc(&client->dev, sizeof(struct mt9m111), GFP_KERNEL); in mt9m111_probe()
955 mt9m111->clk = v4l2_clk_get(&client->dev, "mclk"); in mt9m111_probe()
962 v4l2_i2c_subdev_init(&mt9m111->subdev, client, &mt9m111_subdev_ops); in mt9m111_probe()
990 ret = soc_camera_power_init(&client->dev, ssdd); in mt9m111_probe()
994 ret = mt9m111_video_probe(client); in mt9m111_probe()
998 mt9m111->subdev.dev = &client->dev; in mt9m111_probe()
1013 static int mt9m111_remove(struct i2c_client *client) in mt9m111_remove() argument
1015 struct mt9m111 *mt9m111 = to_mt9m111(client); in mt9m111_remove()