Commit e6609f2c authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull media fixes from Mauro Carvalho Chehab:
 "A couple of driver fixes:

   - hantro: Fix check for single irq

   - cedrus: Fix SUNXI tile size calculation

   - s5p-jpeg: rename JPEG marker constants to prevent build warnings

   - ir_toy: prevent device from hanging during transmit"

* tag 'media/v5.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
  media: ir_toy: prevent device from hanging during transmit
  media: s5p-jpeg: rename JPEG marker constants to prevent build warnings
  media: cedrus: Fix SUNXI tile size calculation
  media: hantro: Fix check for single irq
parents c388a189 f0c15b36
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -1140,8 +1140,8 @@ static bool s5p_jpeg_parse_hdr(struct s5p_jpeg_q_data *result,
			continue;
		length = 0;
		switch (c) {
		/* SOF0: baseline JPEG */
		case SOF0:
		/* JPEG_MARKER_SOF0: baseline JPEG */
		case JPEG_MARKER_SOF0:
			if (get_word_be(&jpeg_buffer, &word))
				break;
			length = (long)word - 2;
@@ -1172,7 +1172,7 @@ static bool s5p_jpeg_parse_hdr(struct s5p_jpeg_q_data *result,
			notfound = 0;
			break;

		case DQT:
		case JPEG_MARKER_DQT:
			if (get_word_be(&jpeg_buffer, &word))
				break;
			length = (long)word - 2;
@@ -1185,7 +1185,7 @@ static bool s5p_jpeg_parse_hdr(struct s5p_jpeg_q_data *result,
			skip(&jpeg_buffer, length);
			break;

		case DHT:
		case JPEG_MARKER_DHT:
			if (get_word_be(&jpeg_buffer, &word))
				break;
			length = (long)word - 2;
@@ -1198,15 +1198,15 @@ static bool s5p_jpeg_parse_hdr(struct s5p_jpeg_q_data *result,
			skip(&jpeg_buffer, length);
			break;

		case SOS:
		case JPEG_MARKER_SOS:
			sos = jpeg_buffer.curr - 2; /* 0xffda */
			break;

		/* skip payload-less markers */
		case RST ... RST + 7:
		case SOI:
		case EOI:
		case TEM:
		case JPEG_MARKER_RST ... JPEG_MARKER_RST + 7:
		case JPEG_MARKER_SOI:
		case JPEG_MARKER_EOI:
		case JPEG_MARKER_TEM:
			break;

		/* skip uninteresting payload markers */
+14 −14
Original line number Diff line number Diff line
@@ -37,15 +37,15 @@
#define EXYNOS3250_IRQ_TIMEOUT		0x10000000

/* a selection of JPEG markers */
#define TEM				0x01
#define SOF0				0xc0
#define DHT				0xc4
#define RST				0xd0
#define SOI				0xd8
#define EOI				0xd9
#define	SOS				0xda
#define DQT				0xdb
#define DHP				0xde
#define JPEG_MARKER_TEM				0x01
#define JPEG_MARKER_SOF0				0xc0
#define JPEG_MARKER_DHT				0xc4
#define JPEG_MARKER_RST				0xd0
#define JPEG_MARKER_SOI				0xd8
#define JPEG_MARKER_EOI				0xd9
#define	JPEG_MARKER_SOS				0xda
#define JPEG_MARKER_DQT				0xdb
#define JPEG_MARKER_DHP				0xde

/* Flags that indicate a format can be used for capture/output */
#define SJPEG_FMT_FLAG_ENC_CAPTURE	(1 << 0)
@@ -187,11 +187,11 @@ struct s5p_jpeg_marker {
 * @fmt:	driver-specific format of this queue
 * @w:		image width
 * @h:		image height
 * @sos:	SOS marker's position relative to the buffer beginning
 * @dht:	DHT markers' positions relative to the buffer beginning
 * @dqt:	DQT markers' positions relative to the buffer beginning
 * @sof:	SOF0 marker's position relative to the buffer beginning
 * @sof_len:	SOF0 marker's payload length (without length field itself)
 * @sos:	JPEG_MARKER_SOS's position relative to the buffer beginning
 * @dht:	JPEG_MARKER_DHT' positions relative to the buffer beginning
 * @dqt:	JPEG_MARKER_DQT' positions relative to the buffer beginning
 * @sof:	JPEG_MARKER_SOF0's position relative to the buffer beginning
 * @sof_len:	JPEG_MARKER_SOF0's payload length (without length field itself)
 * @size:	image buffer size in bytes
 */
struct s5p_jpeg_q_data {
+20 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ static const u8 COMMAND_VERSION[] = { 'v' };
// End transmit and repeat reset command so we exit sump mode
static const u8 COMMAND_RESET[] = { 0xff, 0xff, 0, 0, 0, 0, 0 };
static const u8 COMMAND_SMODE_ENTER[] = { 's' };
static const u8 COMMAND_SMODE_EXIT[] = { 0 };
static const u8 COMMAND_TXSTART[] = { 0x26, 0x24, 0x25, 0x03 };

#define REPLY_XMITCOUNT 't'
@@ -309,12 +310,30 @@ static int irtoy_tx(struct rc_dev *rc, uint *txbuf, uint count)
		buf[i] = cpu_to_be16(v);
	}

	buf[count] = cpu_to_be16(0xffff);
	buf[count] = 0xffff;

	irtoy->tx_buf = buf;
	irtoy->tx_len = size;
	irtoy->emitted = 0;

	// There is an issue where if the unit is receiving IR while the
	// first TXSTART command is sent, the device might end up hanging
	// with its led on. It does not respond to any command when this
	// happens. To work around this, re-enter sample mode.
	err = irtoy_command(irtoy, COMMAND_SMODE_EXIT,
			    sizeof(COMMAND_SMODE_EXIT), STATE_RESET);
	if (err) {
		dev_err(irtoy->dev, "exit sample mode: %d\n", err);
		return err;
	}

	err = irtoy_command(irtoy, COMMAND_SMODE_ENTER,
			    sizeof(COMMAND_SMODE_ENTER), STATE_COMMAND);
	if (err) {
		dev_err(irtoy->dev, "enter sample mode: %d\n", err);
		return err;
	}

	err = irtoy_command(irtoy, COMMAND_TXSTART, sizeof(COMMAND_TXSTART),
			    STATE_TX);
	kfree(buf);
+1 −1
Original line number Diff line number Diff line
@@ -919,7 +919,7 @@ static int hantro_probe(struct platform_device *pdev)
		if (!vpu->variant->irqs[i].handler)
			continue;

		if (vpu->variant->num_clocks > 1) {
		if (vpu->variant->num_irqs > 1) {
			irq_name = vpu->variant->irqs[i].name;
			irq = platform_get_irq_byname(vpu->pdev, irq_name);
		} else {
+1 −1
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ void cedrus_prepare_format(struct v4l2_pix_format *pix_fmt)
		sizeimage = bytesperline * height;

		/* Chroma plane size. */
		sizeimage += bytesperline * height / 2;
		sizeimage += bytesperline * ALIGN(height, 64) / 2;

		break;