Lines Matching refs:canvas

41 static void canvas_write(struct meson_canvas *canvas, u32 reg, u32 val)  in canvas_write()  argument
43 writel_relaxed(val, canvas->reg_base + reg); in canvas_write()
46 static u32 canvas_read(struct meson_canvas *canvas, u32 reg) in canvas_read() argument
48 return readl_relaxed(canvas->reg_base + reg); in canvas_read()
55 struct meson_canvas *canvas; in meson_canvas_get() local
74 canvas = dev_get_drvdata(&canvas_pdev->dev); in meson_canvas_get()
75 if (!canvas) in meson_canvas_get()
78 return canvas; in meson_canvas_get()
82 int meson_canvas_config(struct meson_canvas *canvas, u8 canvas_index, in meson_canvas_config() argument
90 if (endian && !canvas->supports_endianness) { in meson_canvas_config()
91 dev_err(canvas->dev, in meson_canvas_config()
96 spin_lock_irqsave(&canvas->lock, flags); in meson_canvas_config()
97 if (!canvas->used[canvas_index]) { in meson_canvas_config()
98 dev_err(canvas->dev, in meson_canvas_config()
101 spin_unlock_irqrestore(&canvas->lock, flags); in meson_canvas_config()
105 canvas_write(canvas, DMC_CAV_LUT_DATAL, in meson_canvas_config()
109 canvas_write(canvas, DMC_CAV_LUT_DATAH, in meson_canvas_config()
117 canvas_write(canvas, DMC_CAV_LUT_ADDR, in meson_canvas_config()
121 canvas_read(canvas, DMC_CAV_LUT_DATAH); in meson_canvas_config()
122 spin_unlock_irqrestore(&canvas->lock, flags); in meson_canvas_config()
128 int meson_canvas_alloc(struct meson_canvas *canvas, u8 *canvas_index) in meson_canvas_alloc() argument
133 spin_lock_irqsave(&canvas->lock, flags); in meson_canvas_alloc()
135 if (!canvas->used[i]) { in meson_canvas_alloc()
136 canvas->used[i] = 1; in meson_canvas_alloc()
137 spin_unlock_irqrestore(&canvas->lock, flags); in meson_canvas_alloc()
142 spin_unlock_irqrestore(&canvas->lock, flags); in meson_canvas_alloc()
144 dev_err(canvas->dev, "No more canvas available\n"); in meson_canvas_alloc()
149 int meson_canvas_free(struct meson_canvas *canvas, u8 canvas_index) in meson_canvas_free() argument
153 spin_lock_irqsave(&canvas->lock, flags); in meson_canvas_free()
154 if (!canvas->used[canvas_index]) { in meson_canvas_free()
155 dev_err(canvas->dev, in meson_canvas_free()
157 spin_unlock_irqrestore(&canvas->lock, flags); in meson_canvas_free()
160 canvas->used[canvas_index] = 0; in meson_canvas_free()
161 spin_unlock_irqrestore(&canvas->lock, flags); in meson_canvas_free()
170 struct meson_canvas *canvas; in meson_canvas_probe() local
173 canvas = devm_kzalloc(dev, sizeof(*canvas), GFP_KERNEL); in meson_canvas_probe()
174 if (!canvas) in meson_canvas_probe()
178 canvas->reg_base = devm_ioremap_resource(dev, res); in meson_canvas_probe()
179 if (IS_ERR(canvas->reg_base)) in meson_canvas_probe()
180 return PTR_ERR(canvas->reg_base); in meson_canvas_probe()
182 canvas->supports_endianness = of_device_get_match_data(dev); in meson_canvas_probe()
184 canvas->dev = dev; in meson_canvas_probe()
185 spin_lock_init(&canvas->lock); in meson_canvas_probe()
186 dev_set_drvdata(dev, canvas); in meson_canvas_probe()