linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Archit Taneja <archit@ti.com>
To: tomi.valkeinen@ti.com
Cc: rohitkc@ti.com, linux-omap@vger.kernel.org,
	linux-fbdev@vger.kernel.org, Archit Taneja <archit@ti.com>
Subject: [RFC PATCH 25/29] OMAPDSS: Writeback: Add sysfs attributes to writeback panel
Date: Tue, 27 Dec 2011 12:49:08 +0000	[thread overview]
Message-ID: <1324989432-3625-26-git-send-email-archit@ti.com> (raw)
In-Reply-To: <1324989432-3625-1-git-send-email-archit@ti.com>

Add the following sysfs attributes to the writeback panel driver:
- paddr
- p_uv_addr
- rotation_type
- color_mode
- pre_mult_alpha
- capture_rate

Signed-off-by: Archit Taneja <archit@ti.com>
---
 drivers/video/omap2/dss/writeback.c |  210 +++++++++++++++++++++++++++++++++++
 1 files changed, 210 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/writeback.c b/drivers/video/omap2/dss/writeback.c
index 215958e..c6450e7 100644
--- a/drivers/video/omap2/dss/writeback.c
+++ b/drivers/video/omap2/dss/writeback.c
@@ -214,8 +214,218 @@ int dss_wb_simple_check(struct omap_dss_writeback *wb,
 
 /* Dummy Writeback Panel driver */
 
+static ssize_t writeback_panel_paddr_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct omap_dss_writeback_info info;
+	struct omap_dss_device *dssdev = to_dss_device(dev);
+	struct omap_dss_writeback *wb = dssdev->wbdev;
+
+	wb->get_wb_info(wb, &info);
+
+	return snprintf(buf, PAGE_SIZE, "%x\n", info.paddr);
+}
+
+static ssize_t writeback_panel_p_uv_addr_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct omap_dss_writeback_info info;
+	struct omap_dss_device *dssdev = to_dss_device(dev);
+	struct omap_dss_writeback *wb = dssdev->wbdev;
+
+	wb->get_wb_info(wb, &info);
+
+	return snprintf(buf, PAGE_SIZE, "%x\n", info.p_uv_addr);
+}
+
+static ssize_t writeback_panel_rotation_type_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct omap_dss_writeback_info info;
+	struct omap_dss_device *dssdev = to_dss_device(dev);
+	struct omap_dss_writeback *wb = dssdev->wbdev;
+
+	wb->get_wb_info(wb, &info);
+
+	return snprintf(buf, PAGE_SIZE, "%d\n", info.rotation_type);
+}
+
+static ssize_t writeback_panel_color_mode_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct omap_dss_writeback_info info;
+	struct omap_dss_device *dssdev = to_dss_device(dev);
+	struct omap_dss_writeback *wb = dssdev->wbdev;
+
+	wb->get_wb_info(wb, &info);
+
+	return snprintf(buf, PAGE_SIZE, "%d\n", info.color_mode);
+}
+
+static ssize_t writeback_panel_color_mode_store(struct device *dev,
+		struct device_attribute *attr, const char *buf,
+		size_t size)
+{
+	int r;
+	int color_mode;
+	struct omap_dss_writeback_info info;
+	struct omap_dss_device *dssdev = to_dss_device(dev);
+	struct omap_dss_writeback *wb = dssdev->wbdev;
+
+	r = kstrtoint(buf, 0, &color_mode);
+	if (r)
+		return r;
+
+	wb->get_wb_info(wb, &info);
+
+	info.color_mode = color_mode;
+
+	r = wb->set_wb_info(wb, &info);
+	if (r) {
+		dev_err(&dssdev->dev, "failed to set color mode %d\n",
+			color_mode);
+		return r;
+	}
+
+	if (dssdev->manager) {
+		r = dssdev->manager->apply(dssdev->manager);
+		if (r)
+			return r;
+	}
+
+	return size;
+}
+
+static ssize_t writeback_panel_pre_mult_alpha_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct omap_dss_writeback_info info;
+	struct omap_dss_device *dssdev = to_dss_device(dev);
+	struct omap_dss_writeback *wb = dssdev->wbdev;
+
+	wb->get_wb_info(wb, &info);
+
+	return snprintf(buf, PAGE_SIZE, "%d\n", info.pre_mult_alpha);
+}
+
+static ssize_t writeback_panel_pre_mult_alpha_store(struct device *dev,
+		struct device_attribute *attr, const char *buf,
+		size_t size)
+{
+	int r;
+	u8 pre_mult_alpha;
+	struct omap_dss_writeback_info info;
+	struct omap_dss_device *dssdev = to_dss_device(dev);
+	struct omap_dss_writeback *wb = dssdev->wbdev;
+
+	r = kstrtou8(buf, 0, &pre_mult_alpha);
+	if (r)
+		return r;
+
+	wb->get_wb_info(wb, &info);
+
+	info.pre_mult_alpha = pre_mult_alpha;
+
+	r = wb->set_wb_info(wb, &info);
+	if (r) {
+		dev_err(&dssdev->dev, "failed to set pre_mult_alpha %d\n",
+			pre_mult_alpha);
+		return r;
+	}
+
+	if (dssdev->manager) {
+		r = dssdev->manager->apply(dssdev->manager);
+		if (r)
+			return r;
+	}
+
+	return size;
+}
+
+static ssize_t writeback_panel_capture_rate_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct omap_dss_writeback_info info;
+	struct omap_dss_device *dssdev = to_dss_device(dev);
+	struct omap_dss_writeback *wb = dssdev->wbdev;
+
+	wb->get_wb_info(wb, &info);
+
+	return snprintf(buf, PAGE_SIZE, "%d\n", info.capture_rate);
+}
+
+static ssize_t writeback_panel_capture_rate_store(struct device *dev,
+		struct device_attribute *attr, const char *buf,
+		size_t size)
+{
+	int r;
+	int capture_rate;
+	struct omap_dss_writeback_info info;
+	struct omap_dss_device *dssdev = to_dss_device(dev);
+	struct omap_dss_writeback *wb = dssdev->wbdev;
+
+	r = kstrtoint(buf, 0, &capture_rate);
+	if (r)
+		return r;
+
+	wb->get_wb_info(wb, &info);
+
+	info.capture_rate = capture_rate;
+
+	r = wb->set_wb_info(wb, &info);
+	if (r) {
+		dev_err(&dssdev->dev, "failed to set capture_rate %d\n",
+			capture_rate);
+		return r;
+	}
+
+	if (dssdev->manager) {
+		r = dssdev->manager->apply(dssdev->manager);
+		if (r)
+			return r;
+	}
+
+	return size;
+}
+
+static DEVICE_ATTR(paddr, S_IRUGO, writeback_panel_paddr_show, NULL);
+static DEVICE_ATTR(p_uv_addr, S_IRUGO, writeback_panel_p_uv_addr_show, NULL);
+static DEVICE_ATTR(rotation_type, S_IRUGO, writeback_panel_rotation_type_show,
+		NULL);
+static DEVICE_ATTR(color_mode, S_IRUGO | S_IWUSR,
+		writeback_panel_color_mode_show,
+		writeback_panel_color_mode_store);
+static DEVICE_ATTR(pre_mult_alpha, S_IRUGO | S_IWUSR,
+		writeback_panel_pre_mult_alpha_show,
+		writeback_panel_pre_mult_alpha_store);
+static DEVICE_ATTR(capture_rate, S_IRUGO | S_IWUSR,
+		writeback_panel_capture_rate_show,
+		writeback_panel_capture_rate_store);
+
+static struct attribute *writeback_attrs[] = {
+	&dev_attr_paddr.attr,
+	&dev_attr_p_uv_addr.attr,
+	&dev_attr_rotation_type.attr,
+	&dev_attr_color_mode.attr,
+	&dev_attr_pre_mult_alpha.attr,
+	&dev_attr_capture_rate.attr,
+	NULL,
+};
+
+static struct attribute_group writeback_attr_group = {
+	.attrs = writeback_attrs,
+};
+
 static int writeback_panel_probe(struct omap_dss_device *dssdev)
 {
+	int r;
+
+	r = sysfs_create_group(&dssdev->dev.kobj, &writeback_attr_group);
+	if (r) {
+		dev_err(&dssdev->dev, "failed to create sysfs files\n");
+		return r;
+	}
+
 	return 0;
 }
 
-- 
1.7.4.1


  parent reply	other threads:[~2011-12-27 12:49 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-27 12:48 [RFC PATCH 00/29] OMAPDSS: Initial Writeback Capture mode support Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 01/29] omapdss/omapfb/omap_vout: Introduce manager output struct Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 02/29] OMAPDSS: Add writeback to omap_dss_mgr_output Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 03/29] OMAPDSS: Writeback: Add writeback interface and panel driver Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 04/29] OMAPDSS: APPLY/Writeback: Add writeback_info Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 05/29] OMAPDSS: APPLY/Writeback: Apply writeback configurations Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 06/29] OMAPDSS: APPLY: Add writeback enable/disable functions Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 07/29] OMAPDSS: APPLY: Add extra_info for writeback Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 08/29] OMAPDSS: APPLY: Modify manager unset device op Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 09/29] OMAPDSS: APPLY: Allow manager set/unset_device ops to set/unset writeback Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 10/29] OMAPDSS: APPLY: Calculate channel_in for writeback Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 11/29] OMAPDSS: DISPC: Add writeback as a new plane Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 12/29] OMAPDSS: Writeback: Add check for color_mode in dss_wb_simple_check() Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 13/29] OMAPDSS: APPLY: Configure writeback FIFOs Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 14/29] OMAPDSS: DISPC: Allow both upscaling and downscaling of chroma Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 15/29] OMAPDSS: DISPC: Pass overlay caps as a parameter to DISPC overlay related function Archit Taneja
2011-12-27 12:48 ` [RFC PATCH 16/29] OMAPDSS: OVERLAY: Add position and replication as overlay caps Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 17/29] OMAPDSS: DISPC: Make dispc_ovl_setup call dispc_plane_setup Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 18/29] OMAPDSS: DISPC: Make chroma_upscale an argument to dispc_plane_setup Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 19/29] OMAPDSS: DISPC: Don't set chroma resampling bit for writeback Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 20/29] OMAPDSS: Writeback: Add writeback capabilities Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 21/29] OMAPDSS: DISPC: Configure overlay-like parameters in dispc_wb_setup Archit Taneja
2012-08-02 10:22   ` Chandrabhanu Mahapatra
2011-12-27 12:49 ` [RFC PATCH 22/29] OMAPDSS: DISPC: Setup writeback go, enable and channel_in functions Archit Taneja
2012-08-02 10:07   ` Mahapatra, Chandrabhanu
2011-12-27 12:49 ` [RFC PATCH 23/29] OMAPDSS: Writeback: Configure writeback specific parameters Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 24/29] OMAPDSS: Writeback: Use panel driver ops to configure mirroring rotation and buffe Archit Taneja
2011-12-27 12:49 ` Archit Taneja [this message]
2011-12-27 12:49 ` [RFC PATCH 26/29] OMAPDSS: DISPLAY: Add a manager apply to sysfs store attributes for writeback Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 27/29] OMAPDSS: MANAGER: Split manager_display_store into smaller functions Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 28/29] OMAPDSS: MANAGER: Add writeback as a sysfs attribute Archit Taneja
2011-12-27 12:49 ` [RFC PATCH 29/29] OMAPDSS: FEATURES: Allow WB panels to attach to managers Archit Taneja

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1324989432-3625-26-git-send-email-archit@ti.com \
    --to=archit@ti.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=rohitkc@ti.com \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).